from ragrails import RagRailsrag = RagRails()rag.ingest( markdown=( "# Refund policy\n\n" "Customers can request a refund within 30 days of purchase. " "Refunds are returned to the original payment method within 5 business days." ), embedding={"provider": "voyage", "model": "voyage-3"}, storage={"vector_db": "qdrant", "collection": "support", "url": "http://localhost:6333"},)
ingest() chunks, embeds, and stores the content in one call. Swap markdown= for docs=, urls=, or api= to load real files, websites, or APIs.
llm = rag.llm(provider="openai", model="gpt-4o-mini")embedder = rag.embedder(provider="voyage", model="voyage-3", input_type="query")result = rag.chat( "How long do I have to request a refund?", llm=llm, embedder=embedder, vector_db="qdrant", collection="support", url="http://localhost:6333", history=[],)print(result.answer)# "You can request a refund within 30 days of purchase."
Chat is stateless. Save result.history and pass it to the next turn to keep context.
ragrails ingest \ --markdown "# Refund policy. Customers can request a refund within 30 days of purchase." \ --vector-db qdrant --collection support --url http://localhost:6333 \ --provider voyage --model voyage-3ragrails chat "How long do I have to request a refund?" \ --vector-db qdrant --collection support --url http://localhost:6333 \ --llm-provider openai --llm-model gpt-4o-mini