Download 01_hello_agent.py from smlflg/AgentSDK-HelloWorld: direct link, hf CLI and curl.
- Browser
- Download file 802 Bytes
-
https://huggingface.co/smlflg/AgentSDK-HelloWorld/resolve/main/01_hello_agent.py
- Command line
-
hf download hf://smlflg/AgentSDK-HelloWorld/01_hello_agent.py
-
curl -L -o 01_hello_agent.py https://huggingface.co/smlflg/AgentSDK-HelloWorld/resolve/main/01_hello_agent.py
802 Bytes
| """ | |
| Hello World — OpenAI Agents SDK mit MiniMax | |
| Einfachster Agent: eine Frage, eine Antwort. | |
| """ | |
| import os | |
| from dotenv import load_dotenv | |
| from openai import AsyncOpenAI | |
| from agents import Agent, Runner, OpenAIChatCompletionsModel, set_tracing_disabled | |
| load_dotenv() | |
| set_tracing_disabled(True) # kein OpenAI Tracing noetig | |
| client = AsyncOpenAI( | |
| base_url="http://localhost:11434/v1", | |
| api_key="ollama", | |
| ) | |
| model = OpenAIChatCompletionsModel(model="mistral-nemo", openai_client=client) | |
| agent = Agent( | |
| name="Hallo", | |
| instructions="Du bist ein freundlicher deutscher Assistent. Antworte kurz und praezise.", | |
| model=model, | |
| ) | |
| if __name__ == "__main__": | |
| result = Runner.run_sync(agent, "Was ist ein Agent SDK in einem Satz?") | |
| print(f"\n--- Ergebnis ---\n{result.final_output}") | |