fix: make vllm tool-calling turns tool-first
This commit is contained in:
@@ -28,12 +28,13 @@ describe('vLLM Response Rewriter', () => {
|
||||
expect(argsObject).toEqual({ path: '/tmp/test.txt' });
|
||||
});
|
||||
|
||||
it('does not touch response that already has tool_calls', () => {
|
||||
it('normalizes response that already has tool_calls into a tool-first shape', () => {
|
||||
const inputResponse = {
|
||||
choices: [{
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: "Here are the calls",
|
||||
thinking: "<think>internal</think>",
|
||||
tool_calls: [
|
||||
{
|
||||
id: "123",
|
||||
@@ -47,7 +48,8 @@ describe('vLLM Response Rewriter', () => {
|
||||
|
||||
const result = rewriteVllmResponse(inputResponse);
|
||||
|
||||
expect(result.choices[0].message.content).toBe("Here are the calls");
|
||||
expect(result.choices[0].message.content).toBe("");
|
||||
expect(result.choices[0].message.thinking).toBe("");
|
||||
expect(result.choices[0].message.tool_calls).toHaveLength(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user