This project is designed to help you learn and experiment with dspy.ai by adding metrics to a simple reasoning task using different language models (LLMs and SLMs).
We'll create a simple question for a chain of thought response to a Language Model and create metrics for what we expect the response to be.
-
cot_slm.py
Given a mathematical problem, use the Chain of Thought primitive, to reason over the answer. Sends this to a locally running SLM (Small Language Model) using Ollama's Llama3.2-1b and prints the response. -
cot.py
Given a mathematical problem, use the Chain of Thought primitive, to reason over the answer. Sends this to an OpenAI model (gpt-4o-mini) and prints the response.
- Clone this repository
- Create
.envfile and fill in OPENAI_API_KEY and CLAUDE_API_KEY API keys - Run scripts
python llm_chatresponse_openai.py