Skip to main content

Astra Assistants API - drop in replacement for OpenAI Assistants, powered by AstraDB

Project description

astra-assistants

Astra Assistants is a drop in replacement for OpenAI's assistant API that supports the full Assistants v2 API (including streaming and vector_stores). This python library wraps the OpenAI SDK with additional capabilities and provides syntactic sugar for passing credentials for third party LLMs.

How to use

Install astra_assistants using your python package manager of choice:

poetry add astra_assistants

import and patch your client:

from openai import OpenAI
from astra_assistants import patch

client = patch(OpenAI())

Server

The astra-assistants server code is now open source (Apache2)!

Check it out here https://github.com/datastax/astra-assistants-api

Authentication

Provide api keys for third party LLMs via environment variables. We support LLM completions through litellm and support litellm environmental variables and models.

Rename the .env.bkp to .env and fill in the appropriate values for the LLMs you want to use.

#!/bin/bash

# AstraDB -> https://astra.datastax.com/ --> tokens --> administrator user --> generate
export ASTRA_DB_APPLICATION_TOKEN=""

# OpenAI Models - https://platform.openai.com/api-keys --> create new secret key
export OPENAI_API_KEY=""

# Groq Models - https://console.groq.com/keys
export GROQ_API_KEY=""

# Anthropic claude models - https://console.anthropic.com/settings/keys
export ANTHROPIC_API_KEY=""

# Gemini models -> https://makersuite.google.com/app/apikey
export GEMINI_API_KEY=""

# Perplexity models -> https://www.perplexity.ai/settings/api  --> generate
export PERPLEXITYAI_API_KEY=""

# Cohere models -> https://dashboard.cohere.com/api-keys
export COHERE_API_KEY=""

# Bedrock models -> https://docs.aws.amazon.com/bedrock/latest/userguide/setting-up.html
export AWS_REGION_NAME=""
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""

# vertexai models https://console.cloud.google.com/vertex-ai
export GOOGLE_JSON_PATH=""
export GOOGLE_PROJECT_ID=""

# AI21 models
export AI21_API_KEY=""

# Aleph Alpha models
export ALEPHALPHA_API_KEY=""

# Anyscale models
export ANYSCALE_API_KEY=""

# Azure models
export AZURE_API_KEY=""
export AZURE_API_BASE=""
export AZURE_API_VERSION=""
export AZURE_AD_TOKEN=""
export AZURE_API_TYPE=""

# Baseten models
export BASETEN_API_KEY=""

# Cloudflare Workers models
export CLOUDFLARE_API_KEY=""
export CLOUDFLARE_ACCOUNT_ID=""

# DeepInfra models
export DEEPINFRA_API_KEY=""

# DeepSeek models
export DEEPSEEK_API_KEY=""

# Fireworks AI models
export FIREWORKS_AI_API_KEY=""

# Hugging Face models
export HUGGINGFACE_API_KEY=""
export HUGGINGFACE_API_BASE=""

# Mistral models
export MISTRAL_API_KEY=""

# NLP Cloud models
export NLP_CLOUD_API_KEY=""

# OpenAI models
export OPENAI_API_KEY=""
export OPENAI_ORGANIZATION=""
export OPENAI_API_BASE=""

# OpenRouter models
export OPENROUTER_API_KEY=""
export OR_SITE_URL=""
export OR_APP_NAME=""

# PaLM models
export PALM_API_KEY=""

# Replicate models
export REPLICATE_API_KEY=""

# TogetherAI models
export TOGETHERAI_API_KEY=""

# Vertex AI models
export VERTEXAI_PROJECT=""
export VERTEXAI_LOCATION=""
export GOOGLE_APPLICATION_CREDENTIALS=""

# Voyage models
export VOYAGE_API_KEY=""

# WatsonX models
export WATSONX_URL=""
export WATSONX_APIKEY=""
export WATSONX_TOKEN=""
export WATSONX_PROJECT_ID=""
export WATSONX_DEPLOYMENT_SPACE_ID=""

# XInference models
export XINFERENCE_API_BASE=""
export XINFERENCE_API_KEY=""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astra_assistants-2.2.4.tar.gz (67.4 kB view details)

Uploaded Source

Built Distribution

astra_assistants-2.2.4-py3-none-any.whl (78.3 kB view details)

Uploaded Python 3

File details

Details for the file astra_assistants-2.2.4.tar.gz.

File metadata

  • Download URL: astra_assistants-2.2.4.tar.gz
  • Upload date:
  • Size: 67.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.8 Linux/6.5.0-1027-oem

File hashes

Hashes for astra_assistants-2.2.4.tar.gz
Algorithm Hash digest
SHA256 30ac594e9eb42e56819120e18a8f9afbb068ba2ceb1f307694f984fe5c9f1beb
MD5 c7e47389b57fe81d3a7c751c106bfe9e
BLAKE2b-256 6c142fc7f5c431a0ad30d7c1d621ca01cefe92705098bf860d51a99f70db8e6b

See more details on using hashes here.

File details

Details for the file astra_assistants-2.2.4-py3-none-any.whl.

File metadata

  • Download URL: astra_assistants-2.2.4-py3-none-any.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.8 Linux/6.5.0-1027-oem

File hashes

Hashes for astra_assistants-2.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3319768171b141d02bf44260d8fb7af2d1a4df76ae67acd7ebdb37acfa898454
MD5 c4497ed34a5a89c64cca7fff81b63544
BLAKE2b-256 bf0bfdda518c054e561287a51c24ff0a530dede389176c5f6973d1c40b1f5881

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page