{"id":9271,"library":"rapidata","title":"Rapidata Python Client","description":"The `rapidata` package provides a Python client to easily interact with the Rapidata Web API, enabling users to programmatically request human annotation for their data. It simplifies creating and managing orders for various human-in-the-loop tasks. The current version is 3.8.0, and the library appears to be under active development with regular updates, supporting Python 3.10 and newer.","status":"active","version":"3.8.0","language":"en","source_language":"en","source_url":"https://github.com/RapidataAI/rapidata-python-sdk","tags":["API client","human-in-the-loop","data annotation","AI/ML","cloud service"],"install":[{"cmd":"pip install -U rapidata","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The primary client class for all API interactions.","symbol":"RapidataClient","correct":"from rapidata import RapidataClient"},{"note":"Used for global configuration of logging, upload settings, and other SDK behaviors.","symbol":"rapidata_config","correct":"from rapidata import rapidata_config"}],"quickstart":{"code":"import os\nfrom rapidata import RapidataClient\n\n# Option 1: Interactive login (opens browser)\n# client = RapidataClient()\n\n# Option 2: Using client ID and secret (recommended for automation)\nclient_id = os.environ.get('RAPIDATA_CLIENT_ID', 'your_client_id_here')\nclient_secret = os.environ.get('RAPIDATA_CLIENT_SECRET', 'your_client_secret_here')\n\nif client_id == 'your_client_id_here' or client_secret == 'your_client_secret_here':\n    print(\"Please set RAPIDATA_CLIENT_ID and RAPIDATA_CLIENT_SECRET environment variables or replace placeholders.\")\n    # Fallback to interactive login for demonstration if env vars are not set\n    # client = RapidataClient() # Uncomment for interactive flow if env vars are missing\nelse:\n    client = RapidataClient(client_id=client_id, client_secret=client_secret)\n\n# Example: Create a simple compare order (requires actual data and context)\n# This is a placeholder as full order creation requires specific data inputs\ntry:\n    # This part is illustrative as it requires actual data (datapoints) and URLs\n    # order_name = \"My Example Alignment Order\"\n    # instruction = \"Which image matches the description better?\"\n    # contexts = [\"A small blue book sitting on a large red book.\"]\n    # datapoints = [[\"https://example.com/image1.jpg\", \"https://example.com/image2.jpg\"]]\n    # order = client.order.create_compare_order(\n    #     name=order_name,\n    #     instruction=instruction,\n    #     contexts=contexts,\n    #     datapoints=datapoints\n    # )\n    # print(f\"Order created: {order.name} (ID: {order.id})\")\n    print(\"RapidataClient initialized. You can now use client.order, client.validation, etc.\")\nexcept Exception as e:\n    print(f\"Could not create order example (requires valid credentials and data): {e}\")\n\n# To reset credentials saved locally:\n# client.reset_credentials()\n","lang":"python","description":"Initializes the `RapidataClient` for interacting with the API. It demonstrates both interactive login (which opens a browser for authentication) and programmatic authentication using `client_id` and `client_secret` environment variables or direct arguments. Once authenticated, the client provides managers for `order` and `validation` operations. An illustrative (commented out) example of creating a compare order is included to show typical usage, noting that actual data points and valid URLs are required."},"warnings":[{"fix":"For automated workflows, generate a Client ID and Secret in your Rapidata settings and pass them directly to the `RapidataClient` constructor: `RapidataClient(client_id=\"YOUR_ID\", client_secret=\"YOUR_SECRET\")` or use environment variables.","message":"The `RapidataClient` can authenticate interactively by opening a browser window for login if `client_id` and `client_secret` are not provided. This is convenient for initial setup but unsuitable for automated scripts or server environments.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always refer to the official 'Migration Guide' (if available on docs.rapidata.ai) or release notes when upgrading between major versions. Test your code thoroughly after any upgrade.","message":"While specific details of breaking changes between major versions (e.g., 2.x to 3.x) are not readily available in public search results, API clients often introduce significant changes to method signatures, object structures, or authentication mechanisms. The documentation mentions versions 2.x and 3.x, implying such changes.","severity":"breaking","affected_versions":"Likely between major versions (e.g., 2.x to 3.x)"},{"fix":"Consult the Rapidata documentation for the exact payload requirements for each API call (e.g., `create_compare_order`). Validate your input data thoroughly before making API requests. Implement robust error handling (try/except) to catch and inspect API responses for detailed error messages.","message":"Rapidata API calls, especially for creating orders, often require specific data formats (e.g., public URLs for images/videos, correctly structured contexts and datapoints). Incorrect formatting or inaccessible URLs will lead to API errors, which might not be immediately clear from the client-side error message.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install -U rapidata` to install the package.","cause":"The `rapidata` package is not installed in your current Python environment.","error":"from rapidata import RapidataClient ModuleNotFoundError: No module named 'rapidata'"},{"fix":"Verify your `client_id` and `client_secret` in your Rapidata account settings. Ensure they are correct and have the necessary permissions. If using environment variables, double-check their values. For interactive login, ensure your browser opened and you successfully completed the authentication flow.","cause":"The provided `client_id` and/or `client_secret` are incorrect, expired, or have insufficient permissions. Alternatively, an interactive login attempt failed or timed out.","error":"Error: Could not authenticate. Please check your client_id and client_secret or log in interactively."},{"fix":"Review the specific Rapidata API documentation for the method you are calling (e.g., `client.order.create_compare_order`). Ensure all `name`, `instruction`, `contexts`, and `datapoints` (or other method-specific parameters) are present and correctly formatted as per the API's expectations.","cause":"An API call, such as `create_compare_order`, was made without providing all required parameters, or the parameters were incorrectly structured.","error":"rapidata.exceptions.RapidataAPIError: {'detail': 'Invalid input data: Missing required field \"datapoints\"'}"}]}