{"id":6847,"library":"ragie","title":"RAGIE Python Client SDK","description":"The `ragie` Python Client SDK, currently at version 1.15.1, provides an idiomatic interface to access the Ragie API for Retrieval-Augmented Generation (RAG) applications. It enables developers to integrate Ragie's RAG capabilities, including document ingestion, chunk retrieval, and interaction with LLMs. The library appears to have a regular release cadence with frequent updates and new features.","status":"active","version":"1.15.1","language":"en","source_language":"en","source_url":"https://github.com/ragieai/ragie-python.git","tags":["AI","LLM","RAG","client","SDK","retrieval-augmented-generation"],"install":[{"cmd":"pip install ragie","lang":"bash","label":"Pip"},{"cmd":"poetry add ragie","lang":"bash","label":"Poetry"}],"dependencies":[{"reason":"Used internally for API calls; can be customized with a custom HTTP client instance.","package":"httpx","optional":false},{"reason":"Commonly used alongside Ragie for LLM interactions in RAG applications.","package":"openai","optional":true},{"reason":"Recommended for securely managing API keys in development environments.","package":"python-dotenv","optional":true}],"imports":[{"symbol":"Ragie","correct":"from ragie import Ragie"}],"quickstart":{"code":"import os\nfrom ragie import Ragie\nfrom dotenv import load_dotenv\n\nload_dotenv() # Load environment variables from .env file\n\nRAGIE_API_KEY = os.environ.get(\"RAGIE_API_KEY\", \"\")\n\nif not RAGIE_API_KEY:\n    raise ValueError(\"RAGIE_API_KEY environment variable not set. Get one at https://secure.ragie.ai/api-keys\")\n\ntry:\n    # Initialize the Ragie client using a context manager for resource cleanup\n    with Ragie(auth=RAGIE_API_KEY) as ragie_client:\n        # Create a raw document\n        print(\"Creating a raw document...\")\n        document = ragie_client.documents.create_raw(request={\n            \"data\": \"The quick brown fox jumps over the lazy dog. A common phrase used to test typewriters.\"\n        })\n        print(f\"Document created with ID: {document.id}\")\n\n        # Wait for the document to be ready (simplified polling for demonstration)\n        print(\"Waiting for document to be ready...\")\n        while True:\n            doc_status = ragie_client.documents.get(document_id=document.id)\n            if doc_status.status == \"ready\":\n                print(f\"Document {document.id} is ready.\")\n                break\n            # In a real application, you'd add a delay (e.g., time.sleep(1)) and/or timeout\n\n        # Retrieve chunks based on a query\n        print(\"Retrieving chunks...\")\n        retrieval = ragie_client.retrievals.retrieve(request={\"query\": \"What is a common phrase?\"})\n        if retrieval.chunks:\n            for chunk in retrieval.chunks:\n                print(f\"Retrieved chunk: {chunk.text}\")\n        else:\n            print(\"No chunks retrieved for the query.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    # Consider handling specific ragie.models.RagieError for API-related issues","lang":"python","description":"This quickstart demonstrates how to initialize the Ragie client, create a raw text document, wait for its processing to complete (indicated by the 'ready' status), and then perform a retrieval query to get relevant information based on the ingested document. Ensure you have `RAGIE_API_KEY` set as an environment variable."},"warnings":[{"fix":"Pin the `ragie` package version in your `requirements.txt` or `pyproject.toml` (e.g., `ragie==1.15.1`).","message":"The SDK is currently in beta. Breaking changes may occur between versions without a major version update. Users are strongly advised to pin their usage to a specific package version to prevent unexpected breaks.","severity":"breaking","affected_versions":"All versions while in beta"},{"fix":"Always initialize the `Ragie` client using a context manager (`with Ragie(...) as client:`). This ensures that HTTP connections and other resources are properly closed and released.","message":"Improper resource management can lead to open HTTP connections and memory leaks in long-lived applications. The `Ragie` client manages underlying `httpx` clients.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement a polling mechanism or listen for webhooks to confirm the document's status is 'ready' before attempting retrievals.","message":"Documents ingested into Ragie are not immediately ready for retrieval. They go through a lifecycle (e.g., `pending`, `partitioning`, `indexed`, `ready`). Attempting to retrieve from a document that is not yet 'ready' will yield incomplete or no results.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `RAGIE_API_KEY` is correctly set and valid. Monitor your usage against plan limits and consider upgrading your plan if necessary. Refer to the Ragie documentation for error codes and resolutions.","message":"Invalid or missing API keys are a common source of authentication failures (401 errors). Additionally, exceeding plan-based rate limits or quotas (e.g., page processing, retrieval limits) can result in 402 or 429 errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}