Skip to content

Commit a0f21c4

Browse files
Update example to work with Ollama Cloud
1 parent 1a1fd19 commit a0f21c4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ print(client.get_languages())
238238
```python
239239
# pip install judge0 ollama
240240
import os
241+
241242
from ollama import Client
242243
import judge0
243244

244-
# Get your Ollama Cloud API key from https://ollama.com.
245+
# Get your free tier Ollama Cloud API key at https://ollama.com.
245246
client = Client(
246247
host="https://ollama.com",
247248
headers={"Authorization": "Bearer " + os.environ.get("OLLAMA_API_KEY")},
@@ -274,10 +275,11 @@ print(f"CODE EXECUTION RESULT:\n{result.stdout}")
274275
```python
275276
# pip install judge0 ollama
276277
import os
278+
277279
from ollama import Client
278280
import judge0
279281

280-
# Get your Ollama Cloud API key from https://ollama.com.
282+
# Get your free tier Ollama Cloud API key at https://ollama.com.
281283
client = Client(
282284
host="https://ollama.com",
283285
headers={"Authorization": "Bearer " + os.environ.get("OLLAMA_API_KEY")},
@@ -335,6 +337,7 @@ print(f'FINAL RESPONSE BY THE MODEL:\n{final_response["message"]["content"]}')
335337

336338
```python
337339
# pip install judge0 ag2[openai]
340+
import os
338341
from typing import Annotated, Optional
339342

340343
from autogen import ConversableAgent, LLMConfig, register_function
@@ -367,12 +370,13 @@ class PythonCodeExecutionTool(Tool):
367370

368371
python_executor = PythonCodeExecutionTool()
369372

373+
# Get your free tier Ollama Cloud API key at https://ollama.com.
370374
llm_config = LLMConfig(
371375
{
372376
"api_type": "openai",
373-
"base_url": "http://localhost:11434/v1",
374-
"api_key": "ollama",
375-
"model": "qwen3-coder:30b",
377+
"base_url": "https://ollama.com/v1",
378+
"api_key": os.environ.get("OLLAMA_API_KEY"),
379+
"model": "qwen3-coder:480b-cloud",
376380
}
377381
)
378382

0 commit comments

Comments
 (0)