Open baskargopinath opened 1 month ago
also hitting this
same here.
I just did some debugging. The _generate
method seems to always return an empty string
The following code block is from around line 398 of langchain_experimental/llms/ollama_functions.py:
system_message = system_message_prompt_template.format(
tools=json.dumps(functions, indent=2)
)
print(f"{messages=}")
response_message = super()._generate(
[system_message] + messages, stop=stop, run_manager=run_manager, **kwargs
)
print(f"{response_message=}")
chat_generation_content = response_message.generations[0].text
print(f"{chat_generation_content=}")
messages=[HumanMessage(content='what is the weather in shenzhen', id='1a5b3d30-aa81-4fe4-acf4-4dec3c7b60f7'), AIMessage(content='', id='run-3d3484d6-f615-42a1-83c3-57da16dde58f-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'weather in shenzhen'}, 'id': 'call_b858f03795424bee96f12ac819572eb2'}]), ToolMessage(content='[{"url": "https://world-weather.info/forecast/china/shenzhen/june-2024/", "content": "Detailed \\u26a1 Shenzhen Weather Forecast for June 2024 - day/night \\ud83c\\udf21\\ufe0f temperatures, precipitations - World-Weather.info. Add the current city. Search. Weather; Archive; Widgets \\u00b0F. World; China; Guangdong; Weather in Shenzhen; Weather in Shenzhen in June 2024. ... 24 +88\\u00b0 +82\\u00b0 25 +86\\u00b0 +82\\u00b0 26 ..."}]', name='tavily_search_results_json', id='1c92f82d-4e5d-4880-993c-c7c0967c85e4', tool_call_id='call_b858f03795424bee96f12ac819572eb2')]
response_message=ChatResult(generations=[ChatGeneration(generation_info={'model': 'qwen2:7b-instruct', 'created_at': '2024-06-24T05:57:25.530385494Z', 'message': {'role': 'assistant', 'content': ''}, 'done': True, 'total_duration': 10381721517, 'load_duration': 884395, 'prompt_eval_count': 164, 'prompt_eval_duration': 10253678000, 'eval_count': 1, 'eval_duration': 49000}, message=AIMessage(content=''))], llm_output=None)
chat_generation_content=''
Error:
ValueError: 'qwen2:7b-instruct' did not respond with valid JSON. Please try again. Response:
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
Trying to get structured output from markdown text using with_structured_output
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found: