Checked other resources
Package (Required)
Example Code (Python)
from typing import List
from pydantic import BaseModel, Field
from dotenv import load_dotenv
from langchain.tools import tool
load_dotenv()
from langchain_tavily import TavilySearch
from langchain_core.messages import HumanMessage
from langchain.agents import create_agent
from langchain_ollama import ChatOllama
class Source(BaseModel):
"""Schema for a source used by the agent"""
url: str = Field(description="The URL of the source")
class AgentResponse(BaseModel):
"""Schema for agent response with answer and sources"""
answer: str = Field(description="Thr agent's answer to the query")
sources: List[Source] = Field(
default_factory=list, description="List of sources used to generate the answer"
)
@tool
def search_website(query : str) -> str:
"""
Search the Website/Internet for provided query and
respond Content from Web for provided query.
Args :
query : str
Output :
Resultant Content for provided query via websearch.
"""
print(f"Searching for {query}")
tool = TavilySearch()
return tool.invoke(query)
llm = ChatOllama(model="gpt-oss:20b-cloud")
tools = [search_website]
agent = create_agent(model=llm, tools=tools)
agent = create_agent(model=llm, tools=tools, response_format=AgentResponse)
def main():
print("Hello from langchain!")
result = agent.invoke(
{"messages": HumanMessage(content="search for 3 job postings for an ai engineer using langchain in the bay area on linkedin and list their details?")},
{
"messages": HumanMessage(
content="search for 3 job postings for an ai engineer using langchain in the bay area on linkedin and list their details?"
)
}
)
print(result)
Error Message and Stack Trace (if applicable)
myenv) PS F:\Udemy\Langchain&LanggraphProject> & C:/Users/solan/anaconda3/envs/myenv/python.exe "f:/Udemy/Langchain&LanggraphProject/main_structure.py"
Traceback (most recent call last):
File "f:\Udemy\Langchain&LanggraphProject\main_structure.py", line 59, in <module>
result = agent.invoke(
^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\pregel\main.py", line 3068, in invoke
for chunk in self.stream(
^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\pregel\main.py", line 2643, in stream
for _ in runner.tick(
^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\pregel\_runner.py", line 167, in tick
run_with_retry(
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\pregel\_retry.py", line 42, in run_with_retry
return task.proc.invoke(task.input, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\_internal\_runnable.py", line 656, in invoke
input = context.run(step.invoke, input, config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langgraph\_internal\_runnable.py", line 400, in invoke
ret = self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain\agents\factory.py", line 1129, in model_node
response = _execute_model_sync(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain\agents\factory.py", line 1102, in _execute_model_sync
output = model_.invoke(messages)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_core\runnables\base.py", line 5534, in invoke
return self.bound.invoke(
^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_core\language_models\chat_models.py", line 398, in invoke
self.generate_prompt(
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_core\language_models\chat_models.py", line 1117, in generate_prompt
return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_core\language_models\chat_models.py", line 927, in generate
self._generate_with_cache(
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_core\language_models\chat_models.py", line 1221, in _generate_with_cache
result = self._generate(
^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_ollama\chat_models.py", line 1025, in _generate
final_chunk = self._chat_stream_with_aggregation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_ollama\chat_models.py", line 960, in _chat_stream_with_aggregation
for chunk in self._iterate_over_stream(messages, stop, **kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_ollama\chat_models.py", line 1049, in _iterate_over_stream
for stream_resp in self._create_chat_stream(messages, stop, **kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\solan\anaconda3\envs\myenv\Lib\site-packages\langchain_ollama\chat_models.py", line 947, in _create_chat_stream
yield from self._client.chat(**chat_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Client.chat() got an unexpected keyword argument 'strict'
During task with name 'model' and id 'ffa00513-5724-b310-4087-ff444c3e5b47'
(myenv) PS F:\Udemy\Langchain&LanggraphProject>
Description
I’ve tried using Python 3.10 and 3.12, but I’m still getting the same error related to the strict parameter. This issue didn’t occur when I was using other local models it seems to be specific to this model. I also tested it directly with Ollama’s Python client, and it worked fine there, but the problem appears when using the LangChain Ollama package.
System Info
(myenv) PS F:\Udemy\Langchain&LanggraphProject> & C:/Users/solan/anaconda3/envs/myenv/python.exe "f:/Udemy/Langchain&LanggraphProject/main_structure.py"
System Information
OS: Windows
OS Version: 10.0.26200
Python Version: 3.12.12 | packaged by Anaconda, Inc. | (main, Oct 21 2025, 20:05:38) [MSC v.1929 64 bit (AMD64)]
Package Information
langchain_core: 1.1.0
langchain: 1.1.0
langchain_community: 0.4.1
langsmith: 0.4.48
langchain_classic: 1.0.0
langchain_groq: 1.1.0
langchain_nvidia_ai_endpoints: 1.0.0
langchain_ollama: 1.0.0
langchain_openai: 1.1.0
langchain_tavily: 0.2.13
langchain_text_splitters: 1.0.0
langgraph_sdk: 0.2.10
Optional packages not installed
langserve
Other Dependencies
aiohttp: 3.13.2
dataclasses-json: 0.6.7
filetype: 1.2.0
groq: 0.36.0
httpx: 0.28.1
httpx-sse: 0.4.3
jsonpatch: 1.33
langgraph: 1.0.4
numpy: 2.3.5
ollama: 0.6.1
openai: 2.8.1
orjson: 3.11.4
packaging: 25.0
pydantic: 2.12.4
pydantic-settings: 2.12.0
pyyaml: 6.0.3
PyYAML: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
SQLAlchemy: 2.0.44
sqlalchemy: 2.0.44
tenacity: 9.1.2
tiktoken: 0.12.0
typing-extensions: 4.15.0
zstandard: 0.25.0
(myenv) PS F:\Udemy\Langchain&LanggraphProject>
Checked other resources
Package (Required)
Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
I’ve tried using Python 3.10 and 3.12, but I’m still getting the same error related to the
strictparameter. This issue didn’t occur when I was using other local models it seems to be specific to this model. I also tested it directly with Ollama’s Python client, and it worked fine there, but the problem appears when using the LangChain Ollama package.System Info
(myenv) PS F:\Udemy\Langchain&LanggraphProject> & C:/Users/solan/anaconda3/envs/myenv/python.exe "f:/Udemy/Langchain&LanggraphProject/main_structure.py"
System Information
Package Information
Optional packages not installed
Other Dependencies