The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
Fix/ollama test cases (#1639)
dbcontributionsb6cfd960d1b4
diff --git a/tests/llms/test_ollama.py b/tests/llms/test_ollama.pyindex af0d22cd6..a781971c1 100644--- a/tests/llms/test_ollama.py+++ b/tests/llms/test_ollama.py@@ -12,7 +12,6 @@ def mock_ollama_client():mock_ollama.return_value = mock_clientyield mock_client[email protected](reason="Mock issue, need to be fixed")def test_generate_response_without_tools(mock_ollama_client):config = BaseLlmConfig(model="llama3.1:70b", temperature=0.7, max_tokens=100, top_p=1.0)llm = OllamaLLM(config)@@ -21,8 +20,9 @@ def test_generate_response_without_tools(mock_ollama_client):{"role": "user", "content": "Hello, how are you?"}]- mock_response = Mock()- mock_response.message = {"content": "I'm doing well, thank you for asking!"}+ mock_response = {+ 'message': {"content": "I'm doing well, thank you for asking!"}+ }mock_ollama_client.chat.return_value = mock_responseresponse = llm.generate_response(messages)@@ -38,7 +38,6 @@ def test_generate_response_without_tools(mock_ollama_client):)assert response == "I'm doing well, thank you for asking!"[email protected](reason="Mock issue, need to be fixed")def test_generate_response_with_tools(mock_ollama_client):config = BaseLlmConfig(model="llama3.1:70b", temperature=0.7, max_tokens=100, top_p=1.0)llm = OllamaLLM(config)@@ -48,18 +47,20 @@ def test_generate_response_with_tools(mock_ollama_client):]tools = [ADD_MEMORY_TOOL]- mock_response = Mock()- mock_message = {"content": "I've added the memory for you."}-- mock_tool_call = {- "function": {- "name": "add_memory",- "arguments": '{"data": "Today is a sunny day."}'+ mock_response = {+ 'message': {+ "content": "I've added the memory for you.",+ "tool_calls": [+ {+ "function": {+ "name": "add_memory",+ "arguments": {"data": "Today is a sunny day."}+ }+ }+ ]}}- mock_message["tool_calls"] = [mock_tool_call]- mock_response.message = mock_messagemock_ollama_client.chat.return_value = mock_responseresponse = llm.generate_response(messages, tools=tools)@@ -79,3 +80,4 @@ def test_generate_response_with_tools(mock_ollama_client):assert len(response["tool_calls"]) == 1assert response["tool_calls"][0]["name"] == "add_memory"assert response["tool_calls"][0]["arguments"] == {'data': 'Today is a sunny day.'}+\ No newline at end of file