-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
const chatMessages: Message[] = [
{ role: 'user', content: 'What is the weather?' },
{
role: 'assistant',
content: null,
toolCalls: [
{
id: 'call_123',
type: 'function',
function: { name: 'get_weather', arguments: '{"location":"Paris"}' }
}
]
},
{
role: 'tool',
toolCallId: 'call_123',
content: '{"temperature": 20}'
}
];
const input = fromChatMessages(chatMessages);
console.log('got input:');
console.log(input);
this prints:
got input:
[
{ role: 'user', content: 'What is the weather?' },
{ role: 'assistant', content: '' },
{
type: 'function_call_output',
callId: 'call_123',
output: '{"temperature": 20}'
}
]
Instead, it should print:
[
{ role: 'user', content: 'What is the weather?' },
{ type: 'function_call', name: 'get_weather', arguments: '{"location":"Paris"}' , callId: 'call_123' },
{
type: 'function_call_output',
callId: 'call_123',
output: '{"temperature": 20}'
}
]
Notice how the tool_call message is improperly converted to a blank assistant message when instead it should be converted to a function_call. This breaks Agentic loops that want to call LLMs using openRouter.callModel, since the input tool request is not properly created.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels