Skip to main content

State-of-the-art RAG pipeline from D-Star AI

Project description

Overview

This python package is only useful for a custom cloud deployment of dsRAG

Usage

pip install dsrag-sdk

Setup

You can set the base url that the sdk connects to by running the following:

from dsrag_sdk.main import set_base_url
set_base_url("http://0.0.0.0:8000")

Knowledge bases

from dsrag_sdk.knowledge_bases import create_knowledge_base, list_knowledge_bases, get_knowledge_base, delete_knowledge_base, update_knowledge_base

Create knowledge base

kb = create_knowledge_base(title="sdk_test_kb", supp_id="test-supp-id")

List knowledge bases

knowledge_bases = list_knowledge_bases()

List with supp_id filter

knowledge_bases = list_knowledge_bases(supp_id="test-supp-id")

Get a knowledge base by id

knowledge_base = get_knowledge_base(knowledge_base_id="test-kb-id")

Update a knowledge base

knowledge_base = update_knowledge_base(knowledge_base_id="test-kb-id", title="updated-title", supp_id="updated-supp-id")

Delete a knowledge base

response = delete_knowledge_base(knowledge_base_id="test-kb-id")

Documents

from dsrag_sdk.documents import create_document_via_text, list_documents, get_document, delete_document

Add a document via text

kb_id = "test-kb-id"
document_text = "This is some test text for document upload"
document = create_document_via_text(kb_id, document_text)

List documents

documents = list_documents(kb_id)

List documents with supp_id filter

documents = list_documents(knowledge_base_id="test-kb-id", supp_id="test-supp-id")

Get document by id

document = get_document(knowledge_base_id="test-kb-id", document_id="test-document-id")

Delete a document

response = delete_document(knowledge_base_id="test-kb-id", document_id="test-document-id")

Chat

from dsrag_sdk.chat import create_chat_thread, list_chat_threads, update_chat_thread, get_chat_thread, delete_chat_thread, get_chat_response, list_thread_interactions

Create a chat thread

response = create_chat_thread(knowledge_base_ids=[kb_id])

List chat threads

chat_threads = list_chat_threads()

Filter with supp_id

chat_threads = list_chat_threads(supp_id="test-supp-id")

Get chat thread by id

chat_thread = get_chat_threads(thread_id="test-thread-id")

Get a chat response

response = get_chat_response(thread_id="test-thread-id", input="What is AGI?")

Update a chat thread

chat_thread = update_chat_thread(thread_id="test-thread-id", knowledge_base_ids=[kb_id_1, kn_id_2], supp_id="updated-supp-id", model="gpt-4o-mini")

Delete a chat thread

response = delete_chat_thread(thread_id="test-thread-id")

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

dsrag_sdk-0.0.8.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

dsrag_sdk-0.0.8-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file dsrag_sdk-0.0.8.tar.gz.

File metadata

  • Download URL: dsrag_sdk-0.0.8.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for dsrag_sdk-0.0.8.tar.gz
Algorithm Hash digest
SHA256 fd8c29fcd83eb6d5568e234bf7164b912b28a9e050d13484156ccbd51ccf44ad
MD5 8966d3aae4dfa38affe971d7e86d1c12
BLAKE2b-256 64ad2cc5bb925e25a9485f57d0ec79cdada52385dca7eead529960f16960db84

See more details on using hashes here.

File details

Details for the file dsrag_sdk-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: dsrag_sdk-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for dsrag_sdk-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f86d17c474e97ec74694f0980cbeb512077647d1bfbb0f8489b69ecab211f3b0
MD5 59a76ed7db1d67d08cf834d830c490f4
BLAKE2b-256 55a6431180b9a21859be1fc9c42918277407edbab53d060161853b39e700369e

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