mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix calling Sonnet 3.7 (#212372)
## Summary Fixes <img width="1509" alt="image" src="https://github.com/user-attachments/assets/ba409fde-f52b-4864-a81a-70025ef61f2f" />
This commit is contained in:
parent
0d0995cb26
commit
8c456d1e1e
1 changed files with 15 additions and 16 deletions
|
@ -56,6 +56,18 @@ export const BedrockToolChoiceSchema = schema.object({
|
|||
name: schema.maybe(schema.string()),
|
||||
});
|
||||
|
||||
export const BedrockUsageSchema = schema.maybe(
|
||||
schema.object(
|
||||
{
|
||||
input_tokens: schema.number(),
|
||||
output_tokens: schema.number(),
|
||||
// added with Sonnet 3.7
|
||||
cache_creation_input_tokens: schema.maybe(schema.number()),
|
||||
},
|
||||
{ unknowns: 'allow' }
|
||||
)
|
||||
);
|
||||
|
||||
export const InvokeAIActionParamsSchema = schema.object({
|
||||
messages: schema.arrayOf(BedrockMessageSchema),
|
||||
model: schema.maybe(schema.string()),
|
||||
|
@ -82,12 +94,7 @@ export const InvokeAIActionParamsSchema = schema.object({
|
|||
|
||||
export const InvokeAIActionResponseSchema = schema.object({
|
||||
message: schema.string(),
|
||||
usage: schema.maybe(
|
||||
schema.object({
|
||||
input_tokens: schema.number(),
|
||||
output_tokens: schema.number(),
|
||||
})
|
||||
),
|
||||
usage: BedrockUsageSchema,
|
||||
});
|
||||
|
||||
export const InvokeAIRawActionParamsSchema = schema.object({
|
||||
|
@ -125,10 +132,7 @@ export const InvokeAIRawActionResponseSchema = schema.object({}, { unknowns: 'al
|
|||
export const RunApiLatestResponseSchema = schema.object(
|
||||
{
|
||||
stop_reason: schema.maybe(schema.string()),
|
||||
usage: schema.object({
|
||||
input_tokens: schema.number(),
|
||||
output_tokens: schema.number(),
|
||||
}),
|
||||
usage: BedrockUsageSchema,
|
||||
content: schema.arrayOf(
|
||||
schema.object(
|
||||
{ type: schema.string(), text: schema.maybe(schema.string()) },
|
||||
|
@ -143,12 +147,7 @@ export const RunActionResponseSchema = schema.object(
|
|||
{
|
||||
completion: schema.string(),
|
||||
stop_reason: schema.maybe(schema.string()),
|
||||
usage: schema.maybe(
|
||||
schema.object({
|
||||
input_tokens: schema.number(),
|
||||
output_tokens: schema.number(),
|
||||
})
|
||||
),
|
||||
usage: BedrockUsageSchema,
|
||||
},
|
||||
{ unknowns: 'ignore' }
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue