Skip to main content

Installation

First, install the SDK using pip:

Authentication

To use the SDK, you’ll need your API credentials:

Basic Operations

Creating a Knowledge Base

Create a new knowledge base with files:

Updating a Knowledge Base

Add more files to an existing knowledge base:

Deleting Files from a Knowledge Base

Remove specific files from your knowledge base:

Deleting a Knowledge Base

Delete an entire knowledge base:

Complete Example

Here’s a complete example showing all operations:

Error Handling

The SDK includes built-in error handling. Always wrap your operations in try-except blocks:

Best Practices

  1. Always check if files exist before trying to create or update a knowledge base
  2. Use unique names for your knowledge bases to avoid conflicts
  3. Clean up resources by deleting knowledge bases when they’re no longer needed
  4. Handle exceptions appropriately in production code
  5. Keep your API credentials secure and never commit them to version control

Additional Configuration

You can also specify a custom base URL for development or testing: