DSPy
Prerequisite
To start using DSPy with Orq, you need an API Key ready within your Orq.ai account.
To setup your API key, see API keys & Endpoints.
Using Orq.ai as Proxy
Using DSPy , set the API Base to the Orq.ai Proxy to feed calls through our API without changing any other part of your code.
Using the Orq.ai Proxy, you benefit from the Platform Traces, Cost and Usage Monitoring, keeping full compatibility and unified API with all models while using the DSPy SDK.
When configuring model, you must reformat the supplier in order for the proxying to function correctly.Example:
openai/gpt-4o-mini
becomesopenai/openai/gpt-4o-mini
api_base:
https://api.orq.ai/v2/proxy
api_key: Your Orq API key
import os
import dspy
lm = dspy.LM('openai/openai/gpt-4o-mini',
api_key=os.getenv("ORQ_API_KEY"),
api_base="https://api.orq.ai/v2/proxy")
dspy.configure(lm=lm)
print(lm("Say this is a test!", temperature=0.7))
Updated about 5 hours ago