[GH-ISSUE #1191] JSON mode when used from LangChain RAG #605

Closed
opened 2026-04-12 10:19:02 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @abaranovskis-redsamurai on GitHub (Nov 18, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1191

Hello,

I would like to ask if there are any plans to support JSON mode response, when Ollama is called from LangChain RAG?

Thanks.

Originally created by @abaranovskis-redsamurai on GitHub (Nov 18, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1191 Hello, I would like to ask if there are any plans to support JSON mode response, when Ollama is called from LangChain RAG? Thanks.
Author
Owner

@abaranovskis-redsamurai commented on GitHub (Nov 19, 2023):

I found example of using Ollama JSON output here - https://github.com/jacoblee93/oss-model-extraction-evals/blob/main/run_evals.py, didn't had chance to run this code yet. But it looks like tightly coupled with OpenAI functions. I wonder if its possible to get JSON output through LangChain without using these functions?

<!-- gh-comment-id:1817958252 --> @abaranovskis-redsamurai commented on GitHub (Nov 19, 2023): I found example of using Ollama JSON output here - https://github.com/jacoblee93/oss-model-extraction-evals/blob/main/run_evals.py, didn't had chance to run this code yet. But it looks like tightly coupled with OpenAI functions. I wonder if its possible to get JSON output through LangChain without using these functions?
Author
Owner

@BruceMacD commented on GitHub (Nov 20, 2023):

Hi @abaranovskis-redsamurai, the Langchain libraries are maintained by the Langchain team. At the moment I do see that the JavaScript library support JSON mode through their OllamaFunctions interface.
https://js.langchain.com/docs/integrations/chat/ollama_functions

<!-- gh-comment-id:1819457705 --> @BruceMacD commented on GitHub (Nov 20, 2023): Hi @abaranovskis-redsamurai, the Langchain libraries are maintained by the Langchain team. At the moment I do see that the JavaScript library support JSON mode through their `OllamaFunctions` interface. https://js.langchain.com/docs/integrations/chat/ollama_functions
Author
Owner

@abaranovskis-redsamurai commented on GitHub (Nov 20, 2023):

Thanks, I will check with Langchain team. I found sample Python notebook with OllamaFunctions (not in master branch): d84bb38993/docs/docs/integrations/chat/ollama_functions.ipynb

<!-- gh-comment-id:1819600066 --> @abaranovskis-redsamurai commented on GitHub (Nov 20, 2023): Thanks, I will check with Langchain team. I found sample Python notebook with OllamaFunctions (not in master branch): https://github.com/langchain-ai/langchain/blob/d84bb3899369d57f5c8dd081edc87ff75ecd79e1/docs/docs/integrations/chat/ollama_functions.ipynb
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#605