Skip to content

Commit

Permalink
[Obs AI Assistant] Don't fail calls where messages have data (#191952)
Browse files Browse the repository at this point in the history
In #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.
  • Loading branch information
dgieselaar authored Sep 3, 2024
1 parent 3c9198a commit 448c9e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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,
Expand All @@ -45,8 +44,7 @@ export const messageRt: t.Type<Message> = t.type({
]),
}),
t.partial({
arguments: serializeableRt,
data: serializeableRt,
arguments: t.string,
}),
]),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '{}',
},
},
];
Expand Down

0 comments on commit 448c9e1

Please sign in to comment.