Skip to content

inkybubble/llm_patterns_openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM Patterns in openai - a multi-turn chat with tool-usage

Chat pipeline with tool calling. Starting point from OpenAI's function calling quickstart. A reference that I can use for other applications, to structure outputs. The horoscope example was inspired by the openai developer guide and lightly modified.

Setup

uv sync

Chat pipeline

src/chat.py - Multi-turn chat class that:

  • Maintains conversation history
  • Routes tool calls to handlers
  • Retries on validation errors for toy structured outputs
  • Respects system prompt instructions

Examples

examples/00_horoscope_pipeline.py - Pipeline test using fake horoscope tools. Tests multi-turn chat, tool selection, input validation, system prompt influence.

uv run examples/00_horoscope_pipeline.py

See examples/00_horoscope_pipeline.md for sample output walkthrough.

About

Patterns for the responses API (openai) and for iterative validation of toy structured output

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages