[Obs AI Assistant] Don't fail calls where messages have data (#191952)

In https://github.com/elastic/kibana/pull/191607, we fixed a bug around
`strictKeysRt` not strictly checking object types in arrays. That
exposed a bug in our `messageRt` type where we define `data`
incorrectly, which means that any conversation that has data (as the
result of some function calls) will fail with a 400. This PR corrects
that mistake.
This commit is contained in:
Dario Gieselaar 2024-09-03 21:21:02 +02:00 committed by GitHub
parent 3c9198abeb
commit 448c9e1328
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -17,8 +17,6 @@ import {
type StarterPrompt,
} from '../../common/types';
const serializeableRt = t.any;
export const messageRt: t.Type<Message> = t.type({
'@timestamp': t.string,
message: t.intersection([
@ -35,6 +33,7 @@ export const messageRt: t.Type<Message> = t.type({
content: t.string,
name: t.string,
event: t.string,
data: t.string,
function_call: t.intersection([
t.type({
name: t.string,
@ -45,8 +44,7 @@ export const messageRt: t.Type<Message> = t.type({
]),
}),
t.partial({
arguments: serializeableRt,
data: serializeableRt,
arguments: t.string,
}),
]),
}),

View file

@ -54,6 +54,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {
message: {
role: MessageRole.User,
content: 'Good morning, bot!',
// make sure it doesn't 400 on `data` being set
data: '{}',
},
},
];