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 #5101
Comments
The error you're encountering, "Unexpected token o in JSON at position 1," typically indicates an issue with JSON parsing, where the const args = { next: "Researcher" }; // Example arguments object
const serializedArgs = JSON.stringify(args); // Serialize the object
route(serializedArgs); // Pass the serialized string to the function This approach ensures that the data passed to functions expecting JSON strings are correctly serialized, avoiding the parsing error you're experiencing. If the function might receive an already parsed object, consider checking the data type before parsing to handle it appropriately. Sources
|
Can you share how you're calling the Mistral Azure model? |
Checked other resources
Example Code
https://github.com/langchain-ai/langgraphjs/blob/main/examples/multi_agent/agent_supervisor.ipynb
Error Message and Stack Trace (if applicable)
Error Encountered:
Description
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:
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:
Mistral API Response Example:
Steps to Reproduce the Bug:
route
function call.System Info
pnpm info langchain
[email protected] | MIT | deps: 17 | versions: 264
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/langchain/
keywords: llm, ai, gpt3, chain, prompt, prompt engineering, chatgpt, machine learning, ml, openai, embeddings, vectorstores
dist
.tarball: https://registry.npmjs.org/langchain/-/langchain-0.1.33.tgz
.shasum: 959f0f023975092569b49f1f07fe60c11c643530
.integrity: sha512-IrRd839x8eAmDutHNDMHGzIjufyWt/ckJrnRB2WifIJmtLWNRNQo5jZd7toeBU0UOVOQxoPtQGYf8lR0ar7vIQ==
.unpackedSize: 4.1 MB
dependencies:
@anthropic-ai/sdk: ^0.9.1 @langchain/openai: ~0.0.28 js-yaml: ^4.1.0 langsmith: ~0.1.7 p-retry: 4 zod-to-json-schema: ^3.22.3
@langchain/community: ~0.0.47 binary-extensions: ^2.2.0 jsonpointer: ^5.0.1 ml-distance: ^4.0.0 uuid: ^9.0.0 zod: ^3.22.4
@langchain/core: ~0.1.56 js-tiktoken: ^1.0.7 langchainhub: ~0.0.8 openapi-types: ^12.1.3 yaml: ^2.2.1
maintainers:
dist-tags:
latest: 0.1.33 next: 0.1.29-rc.0
published 4 days ago by jacoblee93 [email protected]
platform : mac
Node version : v18.17.0
pnpm version : 8.15.5
The text was updated successfully, but these errors were encountered: