Commit Graph

3 Commits

Author SHA1 Message Date
6a397e3a69 chore: replace hardcoded api key with env import and update setup instructions in openai_agent_example.py 2024-12-22 10:25:17 +00:00
cae85929bc feat: add streaming response support to openai agent example with stream=True and token iteration
Added a new `stream_response` function that yields tokens incrementally by setting `stream=True` on the chat completion call and iterating over response chunks. The example now includes a `main` block that calls this function with a sample prompt, demonstrating real-time output for interactive use cases. Also fixed grammar and punctuation in docstrings, corrected the pip install package name from `openapi` to `openai`, and improved clarity of setup instructions.
2024-12-20 19:00:20 +00:00
3932cec51a feat: add openai_agent_example.py demonstrating agent integration with OpenAI API
Introduce a new 219-line example script that implements an Agent class for building AI agents using the OpenAI API. The script includes setup instructions, fake API credentials for educational purposes, async support via asyncio, and a full chat history tracking mechanism through the messages property.
2024-12-20 17:49:17 +00:00