Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Ground an agent in documents using RAG.
Create the agent
from definable.agent import Agent from definable.knowledge import Knowledge from definable.vectordb import InMemoryVectorDB knowledge = Knowledge(vector_db=InMemoryVectorDB()) knowledge.add("Definable supports 10 LLM providers: OpenAI, Anthropic, Google, DeepSeek, Mistral, Moonshot, xAI, Perplexity, Ollama, and OpenRouter.") knowledge.add("Agents can use tools, knowledge, memory, middleware, and tracing.") knowledge.add("The @tool decorator converts Python functions into agent-callable tools.") agent = Agent( model="gpt-4o", knowledge=knowledge, instructions="Answer questions using the provided knowledge base. Cite specific facts.", ) output = agent.run("What LLM providers does Definable support?") print(output.content)
Install dependencies
pip install definable
uv pip install definable
poetry add definable
Export your API key
export OPENAI_API_KEY=sk-***
setx OPENAI_API_KEY sk-***
Run
python agent_knowledge.py
agent = Agent(model="gpt-4o", knowledge="./docs/")