Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# API_HOST can be either azure or openai:
# API_HOST can be either azure, ollama or openai:
API_HOST=azure
# Configure for Azure:
AZURE_OPENAI_ENDPOINT=https://YOUR-AZURE-OPENAI-SERVICE-NAME.openai.azure.com
AZURE_OPENAI_CHAT_DEPLOYMENT=YOUR-AZURE-DEPLOYMENT-NAME
# Config for Ollama
OLLAMA_BASE_URL=http://localhost:11434/v1
OLLAMA_MODEL=qwen3.5:0.8b
OLLAMA_API_KEY="dummy_key"
# Configure for OpenAI.com:
OPENAI_API_KEY=YOUR-OPENAI-KEY
OPENAI_MODEL=gpt-5.4
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,32 @@ The dev container includes a Redis server, which is used by the `agent_history_r
* [Python 3.10+](https://www.python.org/downloads/)
* [uv](https://docs.astral.sh/uv/getting-started/installation/)
* Git
* Ollama - (optional for local Ollama model api call)

2. Clone the repository:

```shell
git clone https://github.com/Azure-Samples/python-agentframework-demos
cd python-agentframework-demos
```
3. Create a virtual environment:

3. Install the dependencies:
```shell
python -m venv .venv
```
3. Activate the virtual environment:

```shell
source .venv/bin/activate
# On Windows: .venv\Scripts\activate
```
4. Install the uv:

```shell
pip uv
```

4. Install the dependencies:

```shell
uv sync
Expand Down
6 changes: 6 additions & 0 deletions examples/agent_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
api_key=token_provider,
model=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
)
elif API_HOST == "ollama":
client = OpenAIChatClient(
base_url=os.environ['OLLAMA_BASE_URL'],
model=os.environ["OLLAMA_MODEL"],
api_key=os.environ['OLLAMA_API_KEY'],
)
else:
client = OpenAIChatClient(
api_key=os.environ["OPENAI_API_KEY"], model=os.environ.get("OPENAI_MODEL", "gpt-5.4")
Expand Down
6 changes: 6 additions & 0 deletions examples/agent_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
api_key=token_provider,
model=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
)
elif API_HOST == "ollama":
client = OpenAIChatClient(
base_url=os.environ['OLLAMA_BASE_URL'],
model=os.environ["OLLAMA_MODEL"],
api_key=os.environ['OLLAMA_API_KEY'],
)
else:
client = OpenAIChatClient(
api_key=os.environ["OPENAI_API_KEY"], model=os.environ.get("OPENAI_MODEL", "gpt-5.4")
Expand Down
6 changes: 6 additions & 0 deletions examples/agent_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
api_key=token_provider,
model=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
)
elif API_HOST == "ollama":
client = OpenAIChatClient(
base_url=os.environ['OLLAMA_BASE_URL'],
model=os.environ["OLLAMA_MODEL"],
api_key=os.environ['OLLAMA_API_KEY'],
)
else:
client = OpenAIChatClient(
api_key=os.environ["OPENAI_API_KEY"], model=os.environ.get("OPENAI_MODEL", "gpt-5.4")
Expand Down
6 changes: 6 additions & 0 deletions examples/workflow_fan_out_fan_in_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
api_key=token_provider,
model=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
)
elif API_HOST == "ollama":
client = OpenAIChatClient(
base_url=os.environ['OLLAMA_BASE_URL'],
model=os.environ["OLLAMA_MODEL"],
api_key=os.environ['OLLAMA_API_KEY'],
)
else:
client = OpenAIChatClient(api_key=os.environ["OPENAI_API_KEY"], model=os.environ.get("OPENAI_MODEL", "gpt-5.4"))

Expand Down