diff --git a/pyproject.toml b/pyproject.toml index 3d79c8d..f6e3434 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,11 +78,11 @@ asyncio_mode = "auto" markers = [ "anthropic: Tests that query the Anthropic API. Requires the ANTHROPIC_API_KEY environment variable to be set.", "litellm_anthropic: Tests that query the Anthropic API via litellm. Requires the ANTHROPIC_API_KEY environment variable to be set.", - "litellm_ollama: Tests that query Ollama via Litellm. Requires ollama to be installed and running on localhost:11434.", + "litellm_ollama: Tests that query Ollama via litellm. Requires ollama to be installed and running on localhost:11434.", "litellm_openai: Tests that query the OpenAI API via litellm. Requires the OPENAI_API_KEY environment variable to be set.", "mistral: Tests that query the Mistral API (via openai). Requires the MISTRAL_API_KEY environment variable to be set.", "openai: Tests that query the OpenAI API. Requires the OPENAI_API_KEY environment variable to be set.", - "openai_ollama: Tests that query Ollama via OpenAI. Requires ollama to be installed and running on localhost:11434.", + "openai_ollama: Tests that query Ollama via openai. Requires ollama to be installed and running on localhost:11434.", ] [tool.ruff] diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return True.-output_types1-bool].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return True.-output_types1-bool].yaml similarity index 82% rename from tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return True.-output_types1-bool].yaml rename to tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return True.-output_types1-bool].yaml index 77a69d2..f99b860 100644 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return True.-output_types1-bool].yaml +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return True.-output_types1-bool].yaml @@ -41,10 +41,10 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-573","object":"chat.completion.chunk","created":1732915688,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_wqha42ih","type":"function","function":{"name":"return_bool","arguments":"{\"value\":true}"}}]},"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-148","object":"chat.completion.chunk","created":1732916961,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_j25hbnia","type":"function","function":{"name":"return_bool","arguments":"{\"value\":true}"}}]},"finish_reason":null}]} - data: {"id":"chatcmpl-573","object":"chat.completion.chunk","created":1732915688,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-148","object":"chat.completion.chunk","created":1732916961,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -55,7 +55,7 @@ interactions: Content-Type: - text/event-stream Date: - - Fri, 29 Nov 2024 21:28:08 GMT + - Fri, 29 Nov 2024 21:49:21 GMT Transfer-Encoding: - chunked status: diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return [1, 2, 3, 4, 5]-output_types2-list].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml similarity index 83% rename from tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return [1, 2, 3, 4, 5]-output_types2-list].yaml rename to tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml index e2fc055..111ef5c 100644 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Return [1, 2, 3, 4, 5]-output_types2-list].yaml +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml @@ -42,11 +42,11 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-877","object":"chat.completion.chunk","created":1732915691,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_kichi5ua","type":"function","function":{"name":"return_list_of_int","arguments":"{\"value\":\"[1, + string: 'data: {"id":"chatcmpl-622","object":"chat.completion.chunk","created":1732916932,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_d45b8f5x","type":"function","function":{"name":"return_list_of_int","arguments":"{\"value\":\"[1, 2, 3, 4, 5]\"}"}}]},"finish_reason":null}]} - data: {"id":"chatcmpl-877","object":"chat.completion.chunk","created":1732915691,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-622","object":"chat.completion.chunk","created":1732916932,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -57,7 +57,7 @@ interactions: Content-Type: - text/event-stream Date: - - Fri, 29 Nov 2024 21:28:11 GMT + - Fri, 29 Nov 2024 21:48:52 GMT Transfer-Encoding: - chunked status: diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Say hello!-output_types0-str].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Say hello!-output_types0-str].yaml new file mode 100644 index 0000000..023545e --- /dev/null +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_acomplete_ollama[Say hello!-output_types0-str].yaml @@ -0,0 +1,144 @@ +interactions: +- request: + body: '{"messages": [{"role": "user", "content": "Say hello!"}], "model": "llama3.1", + "stream": true, "stream_options": {"include_usage": true}}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '137' + content-type: + - application/json + host: + - localhost:11434 + user-agent: + - AsyncOpenAI/Python 1.54.4 + x-stainless-arch: + - arm64 + x-stainless-async: + - async:asyncio + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.54.4 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.10.15 + method: POST + uri: http://localhost:11434/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916924,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916924,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916924,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + It"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916924,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"''s"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916924,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + nice"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + to"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + meet"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + you"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + Is"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + there"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + something"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + I"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + can"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + help"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + with"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916925,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + or"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + would"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + you"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + like"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + to"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + chat"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} + + + data: {"id":"chatcmpl-894","object":"chat.completion.chunk","created":1732916926,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + + + data: [DONE] + + + ' + headers: + Content-Type: + - text/event-stream + Date: + - Fri, 29 Nov 2024 21:48:44 GMT + Transfer-Encoding: + - chunked + status: + code: 200 + message: OK +version: 1 diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Say hello!-output_types0-str].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Say hello!-output_types0-str].yaml deleted file mode 100644 index bbbe710..0000000 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_async[Say hello!-output_types0-str].yaml +++ /dev/null @@ -1,129 +0,0 @@ -interactions: -- request: - body: '{"messages": [{"role": "user", "content": "Say hello!"}], "model": "llama3.1", - "stream": true, "stream_options": {"include_usage": true}}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '137' - content-type: - - application/json - host: - - localhost:11434 - user-agent: - - AsyncOpenAI/Python 1.54.4 - x-stainless-arch: - - arm64 - x-stainless-async: - - async:asyncio - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.54.4 - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.10.15 - method: POST - uri: http://localhost:11434/v1/chat/completions - response: - body: - string: 'data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915683,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - How"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - are"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - you"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - doing"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - today"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - Is"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - there"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - anything"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - I"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915684,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - can"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - help"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - with"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - or"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - chat"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - about"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-402","object":"chat.completion.chunk","created":1732915685,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} - - - data: [DONE] - - - ' - headers: - Content-Type: - - text/event-stream - Date: - - Fri, 29 Nov 2024 21:28:03 GMT - Transfer-Encoding: - - chunked - status: - code: 200 - message: OK -version: 1 diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return True.-output_types1-bool].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return True.-output_types1-bool].yaml index 7b3ab70..3686fe6 100644 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return True.-output_types1-bool].yaml +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return True.-output_types1-bool].yaml @@ -41,10 +41,10 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-341","object":"chat.completion.chunk","created":1732915676,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_dxlghlch","type":"function","function":{"name":"return_bool","arguments":"{\"value\":true}"}}]},"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-826","object":"chat.completion.chunk","created":1732916920,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_kve3oltz","type":"function","function":{"name":"return_bool","arguments":"{\"value\":true}"}}]},"finish_reason":null}]} - data: {"id":"chatcmpl-341","object":"chat.completion.chunk","created":1732915676,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-826","object":"chat.completion.chunk","created":1732916920,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -55,7 +55,7 @@ interactions: Content-Type: - text/event-stream Date: - - Fri, 29 Nov 2024 21:27:56 GMT + - Fri, 29 Nov 2024 21:48:40 GMT Transfer-Encoding: - chunked status: diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml index 4b8fe6c..986c0b3 100644 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Return [1, 2, 3, 4, 5]-output_types2-list].yaml @@ -42,11 +42,11 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-168","object":"chat.completion.chunk","created":1732915680,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_ygc23skr","type":"function","function":{"name":"return_list_of_int","arguments":"{\"value\":\"[1, + string: 'data: {"id":"chatcmpl-908","object":"chat.completion.chunk","created":1732916923,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"","tool_calls":[{"id":"call_28sm5ma0","type":"function","function":{"name":"return_list_of_int","arguments":"{\"value\":\"[1, 2, 3, 4, 5]\"}"}}]},"finish_reason":null}]} - data: {"id":"chatcmpl-168","object":"chat.completion.chunk","created":1732915680,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-908","object":"chat.completion.chunk","created":1732916923,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -57,7 +57,7 @@ interactions: Content-Type: - text/event-stream Date: - - Fri, 29 Nov 2024 21:28:00 GMT + - Fri, 29 Nov 2024 21:48:43 GMT Transfer-Encoding: - chunked status: diff --git a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Say hello!-output_types0-str].yaml b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Say hello!-output_types0-str].yaml index 7f3a541..d6cea13 100644 --- a/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Say hello!-output_types0-str].yaml +++ b/tests/chat_model/cassettes/test_openai_chat_model_ollama/test_openai_chat_model_complete_ollama[Say hello!-output_types0-str].yaml @@ -37,98 +37,91 @@ interactions: uri: http://localhost:11434/v1/chat/completions response: body: - string: 'data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} + string: 'data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916915,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - It"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + How"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"''s"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + are"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - nice"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - to"},"finish_reason":null}]} - - - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - meet"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + you"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" - you"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + today"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915672,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" Is"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" there"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" something"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" I"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" can"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916916,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" help"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" you"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" or"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" would"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" you"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" like"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915673,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915674,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":" chat"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915674,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"finish_reason":null}]} - data: {"id":"chatcmpl-725","object":"chat.completion.chunk","created":1732915674,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} + data: {"id":"chatcmpl-10","object":"chat.completion.chunk","created":1732916917,"model":"llama3.1","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]} data: [DONE] @@ -139,7 +132,7 @@ interactions: Content-Type: - text/event-stream Date: - - Fri, 29 Nov 2024 21:27:52 GMT + - Fri, 29 Nov 2024 21:48:35 GMT Transfer-Encoding: - chunked status: diff --git a/tests/chat_model/test_openai_chat_model_ollama.py b/tests/chat_model/test_openai_chat_model_ollama.py index b9d0a66..6f3174b 100644 --- a/tests/chat_model/test_openai_chat_model_ollama.py +++ b/tests/chat_model/test_openai_chat_model_ollama.py @@ -30,7 +30,7 @@ def test_openai_chat_model_complete_ollama(prompt, output_types, expected_output ], ) @pytest.mark.openai_ollama -async def test_openai_chat_model_complete_async( +async def test_openai_chat_model_acomplete_ollama( prompt, output_types, expected_output_type ): chat_model = OpenaiChatModel("llama3.1", base_url="http://localhost:11434/v1/")