From eba599420f88b212bae395ae47be0ae7346f840f Mon Sep 17 00:00:00 2001 From: Morad Moqbel <116935498+MoradMoqbel@users.noreply.github.com> Date: Sun, 13 Sep 2026 11:25:52 +0300 Subject: [PATCH] [Litellm-ollama-docker-image] [ApiPatch] Migrate deprecated openai API calls (1 file) --- cookbook/litellm-ollama-docker-image/requirements.txt | 1 + cookbook/litellm-ollama-docker-image/test.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cookbook/litellm-ollama-docker-image/requirements.txt b/cookbook/litellm-ollama-docker-image/requirements.txt index 9b9181b2360..ebce8deb512 100644 --- a/cookbook/litellm-ollama-docker-image/requirements.txt +++ b/cookbook/litellm-ollama-docker-image/requirements.txt @@ -1 +1,2 @@ litellm==1.83.14 +openai>=1.0.0 diff --git a/cookbook/litellm-ollama-docker-image/test.py b/cookbook/litellm-ollama-docker-image/test.py index 93b9c6ac4a7..22181027bf1 100644 --- a/cookbook/litellm-ollama-docker-image/test.py +++ b/cookbook/litellm-ollama-docker-image/test.py @@ -2,13 +2,12 @@ import openai api_base = "http://0.0.0.0:8000" -openai.api_base = api_base -openai.api_key = "temp-key" -print(openai.api_base) +client = openai.OpenAI(base_url=api_base, api_key="temp-key") +print(client.base_url) print("LiteLLM: response from proxy with streaming") -response = openai.ChatCompletion.create( +response = client.chat.completions.create( model="ollama/llama2", messages=[ { @@ -22,7 +21,7 @@ response = openai.ChatCompletion.create( for chunk in response: print(f"LiteLLM: streaming response from proxy {chunk}") -response = openai.ChatCompletion.create( +response = client.chat.completions.create( model="ollama/llama2", messages=[ {