Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Parsing Error with Mistral Azure using tools and chain #115

Open
alenoir opened this issue Apr 12, 2024 · 0 comments
Open

JSON Parsing Error with Mistral Azure using tools and chain #115

alenoir opened this issue Apr 12, 2024 · 0 comments

Comments

@alenoir
Copy link

alenoir commented Apr 12, 2024

I am encountering an issue when running code from the agent_supervisor.ipynb file while using the Mistral Azure model. I receive a JSON parsing error.

Error Encountered:

Function "route" arguments:

[object Object]

are not valid JSON.
Error: Unexpected token o in JSON at position 1

Expected Behavior:
The arguments passed to the function should be interpreted as a valid JSON string, similar to the behavior when using the Mistral API.

Observed Behavior:
With the Azure SDK, arguments appear to be passed as an object, which does not meet expectations and causes a JSON parsing error.

Azure SDK Response Example:

{
   "lc": 1,
   "type": "constructor",
   "id": ["langchain_core", "messages", "AIMessage"],
   "kwargs": {
     "content": "",
     "tool_calls": [],
     "invalid_tool_calls": [
       {
         "name": "route",
         "args": {
           "next": "Researcher"
         },
         "id": "call_route_0",
         "error": "Function \"route\" arguments:\n\n[object Object]\n\nare not valid JSON.\nError: Unexpected token o in JSON at position 1"
       }
     ],
     "additional_kwargs": {
       "tool_calls": [
         {
           "function": {
             "arguments": {
               "next": "Researcher"
             },
             "call_id": null,
             "name": "route"
           },
           "id": "call_route_0",
           "type": "function"
         }
       ]
     },
     "response_metadata": {
       "tokenUsage": {
         "completionTokens": 23,
         "promptTokens": 228,
         "totalTokens": 251
       },
       "finish_reason": "tool_calls"
     }
   }
}

Mistral API Response Example:

{
   "lc": 1,
   "type": "constructor",
   "id": ["langchain_core", "messages", "AIMessage"],
   "kwargs": {
     "content": "",
     "tool_calls": [
       {
         "name": "route",
         "args": {
           "next": "Researcher"
         },
         "id": "d850f8fa32c14af1933b6986e2f997cd"
       }
     ],
     "invalid_tool_calls": [],
     "additional_kwargs": {
       "tool_calls": [
         {
           "function": {
             "name": "route",
             "arguments": "{\"next\": \"Researcher\"}"
           }
         }
       ]
     },
     "response_metadata": {
       "tokenUsage": {
         "completionTokens": 22,
         "promptTokens": 227,
         "totalTokens": 249
       },
       "finish_reason": "tool_calls"
     }
   }
}

Steps to Reproduce the Bug:

  1. Set up the environment with the Azure SDK.
  2. Run the agent_supervisor.ipynb notebook using the Mistral Azure model.
  3. Observe the error during the route function call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant