Documentation
install it in python with pip install Ornymo
How does it work:It checks cached results first, and if none exist, it invokes your agent and stores the new output.
- The apikey argument takes the api key you can find in our dashboard
- history is any context such as previous chats for the models to use
- The query argument is the users query so we can try to match it in our system
- The output which you only pass in caching is if the model cant find anything cache this output
Importing the SDK
from Ornymo import Ornymo
- query_check() — Looks for a cached response based on the user’s query history.
- caching() — Saves the new output for future queries.We have to pass the models output here
FastAPI Example
@app.post("/submit/query")
async def submit_query(user: user_dependency):
# Initialize Ornymo SDK
ornymo = Ornymo(
apiKey="api_provider",
history=user.history,
query=user_dependency
)
# Check if the query exists in cache
cached = await ornymo.query_check()
if cached:
return {"result": cached}
# No cache found — invoke your agent
response = agent.invoke("hey whats the weather")
# Store the new response in cache
await ornymo.caching(output=response)
return {"result": response}