DSPy
Use the Orq.ai AI Gateway with Stanford DSPy for programmatic prompting
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.
To use libraries with private models, see Onboarding Private Models.
Using Orq.ai as AI Gateway
Using DSPy , set the API Base to the AI Gateway to feed calls through our API without changing any other part of your code.
Using the Orq.ai AI Gateway, you benefit from the Platform Traces, Cost and Usage Monitoring, keeping full compatibility and a unified API with all models while using the DSPy SDK.
When configuring model, you must reformat the supplier in order for the call 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 2 hours ago