mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(agent): include model in structured response output (#4092)
* fix(agent): include model in structured response output * fix(agent): update test expectation for model in structured response
This commit is contained in:
@@ -667,6 +667,7 @@ describe('AgentBlockHandler', () => {
|
||||
expect(result).toEqual({
|
||||
result: 'Success',
|
||||
score: 0.95,
|
||||
model: 'mock-model',
|
||||
tokens: { input: 10, output: 20, total: 30 },
|
||||
toolCalls: { list: [], count: 0 },
|
||||
providerTiming: { total: 100 },
|
||||
|
||||
@@ -1070,19 +1070,20 @@ export class AgentBlockHandler implements BlockHandler {
|
||||
private processStandardResponse(result: any): BlockOutput {
|
||||
return {
|
||||
content: result.content,
|
||||
model: result.model,
|
||||
...this.createResponseMetadata(result),
|
||||
...(result.interactionId && { interactionId: result.interactionId }),
|
||||
}
|
||||
}
|
||||
|
||||
private createResponseMetadata(result: {
|
||||
model?: string
|
||||
tokens?: { input?: number; output?: number; total?: number }
|
||||
toolCalls?: Array<any>
|
||||
timing?: any
|
||||
cost?: any
|
||||
}) {
|
||||
return {
|
||||
model: result.model,
|
||||
tokens: result.tokens || {
|
||||
input: DEFAULTS.TOKENS.PROMPT,
|
||||
output: DEFAULTS.TOKENS.COMPLETION,
|
||||
|
||||
Reference in New Issue
Block a user