Skip to main content

A simple framework to build and deploy AI tools.

Project description

Firedust: fast development and deployment of AI tools

Firedust makes it simple to build and deploy AI tools, minimizing the time from idea to working product.

Tests Package version Supported python versions REST API Docs


API Documentation: https://api.firedust.dev/redoc

Python SDK: https://github.com/ion2088/firedust


Features

Assistants

  • Rapid Deployment: Deploy AI assistants in seconds for quick testing and iteration.
  • Model Flexibility: Seamlessly switch between GPT-4, Mistral, or other models to find the best fit.
  • Integration Options: Deploy to Slack or integrate via API into your apps.
  • Real-time Training: Add your data and train the assistant in real-time.
  • Dynamic Context Recall: Assistants utilize past conversations and user-added data to generate responses, clearly referencing the specific data sources used in their answers.
  • Group Chat: Support for both group and one-on-one interactions.
  • Privacy and Security: Chats are private, with data encrypted both in transit and at rest.
  • Asynchronous Support: Fully supports asynchronous programming.
  • Seamless Updates: Configure and update assistants without downtime.

Quickstart

Get your api key here and set it as an environment variable:

export FIREDUST_API_KEY=your_api_key

Install the package:

pip install firedust

Examples

Create a new assistant

Your assistant is ready to chat in seconds.

import firedust

assistant = firedust.assistant.create(
    name="Samwise",
    instructions="1. Protect the ring bearer. 2. Do not let the ring corrupt you.",
    model="mistral/mistral-medium", # you can easily switch between models
)

# ask a question
question = "What is the shortest way to Mordor?"
response = assistant.chat.message(question)
print(response.message)

# stream
for event in assistant.chat.stream(question):
    print(event.message)

Load an existing assistant

Load your assistants anywhere in your code to interact, add more data, deploy or change configuration.

import firedust

assistant = firedust.assistant.load("Samwise")

Add your data

Integrate your data into the assistant's memory for real-time accessibility. Users can effortlessly retrieve information by simply chatting with the assistant, making natural language the new way to query data.

important_data = [
    "Do not trust Smeagol.",
    "The ring is evil, it must be destroyed.",
]
for data in important_data:
    assistant.learn.fast(data)

response = assistant.chat.message("What should I do with the ring?")
assert "destroy" in response.message.lower()

# see which data sources were used in the response
print(response.references)

Deploy to Slack

Deploy your assistants to slack to chat in groups or one-on-one. Firedust handles the deployment, server management and scaling for you. The slack app is open sourced.

config_token = "CONFIGURATION_TOKEN" # you can find your configuration token here: https://api.slack.com/apps
assistant.interface.slack.create_app(
    description="A short description of the assistant.",
    greeting="A greeting message for the users.",
    configuration_token=config_token,  
)

# install the app in your slack workspace UI and generate tokens. See here: https://api.slack.com/apps/
app_token = "APP_TOKEN"
bot_token = "BOT_TOKEN"

# set the tokens
assistant.interface.slack.set_tokens(
    app_token=app_token,
    bot_token=bot_token,
)

# deploy the assistant
assistant.interface.slack.deploy()

Group chat

Engage in group chats by simply annotating messages for different users. You can also add previous chat history to improve the responses.

import firedust

assistant = firedust.assistant.load(name="Sam")

# add previous chat history to the assistant's memory
message1 = Message(
    assistant="Sam",
    user="product_team", # group name
    message="John: Based on the last discussion, we've made the following changes to the product...", # annotate each message with the username
    author="user",
)
message2 = Message(
    assistant="Sam",
    user="product_team",
    message="Helen: John, could you please share the updated product roadmap?",
    author="user",
)
message3 = Message(
    assistant="Sam",
    user="product_team",
    message="John: Sure, the new roadmap is the following...",
    author="user",
)

assistant.chat.add_history([message1, message2, message3])

# chat in a group
response = assistant.chat.message(
    message="Troy: @Sam, who is sharing the new product roadmap?",
    user="product_team", # group name
)
assert "John" in response.message

Manage memories

Gain granular control over the assistant's memory. You can recall, add, list, retrieve, and delete data points. Assistants' memories can also be fully synced, ensuring precise management of the data available to your users.

import firedust

sam = firedust.assistant.create(name="Samwise")

# add data to the assistant's memory
data = [
    "To reach Mordor, follow the path through the Mines of Moria.",
    "The ring must be destroyed in the fires of Mount Doom.",
]
for item in data:
    sam.learn.fast(item)

# list all available memories (with pagination)
memory_ids = sam.memory.list(limit=100, offset=0)

# load the content of specific memories
memories = sam.memory.get(memory_ids[:10])

# recall memories based on a query
query = "Guidance to reach Mordor."
mordor_memories = sam.memory.recall(query)

# share selected memories with another assistant
frodo = firedust.assistant.create(name="Frodo")
frodo.memory.add(mordor_memories)

# sync all memories with another assistant
sam.memory.share(assistant_receiver="Frodo")

# stop sharing memories with another assistant
sam.memory.unshare(assistant_receiver="Frodo")

# delete specific memories
sam.memory.delete(memory_ids[:10])

Update assistant

Easily update configurations without downtime.

import firedust

assistant = firedust.assistant.load(name="Sam")

# update the assistant's inference model
assistant.update.model("mistral/mistral-medium")

# update the assistant's instructions
assistant.update.instructions(
    """
    1. Protect the ring bearer. 
    2. Do not let the ring corrupt you.
    """
)

# all changes are saved and applied immediately

User privacy

Conversations with the assistant are always private.

import firedust

assistant = firedust.assistant.load("Sam")

user1 = "Pippin"
user2 = "Merry"

# user1 shares some important information with the assistant
assistant.chat.message(
    message="My favourite desert is cinnamon bun.",
    user=user1,
)
response = assistant.chat.message(
    message="What is my favourite desert?",
    user=user1,
)
assert "cinnamon bun" in response.message.lower()

# user2 has no access to this information
response = assistant.chat.message(
    message="What is Pippin's favourite desert?",
    user=user2,
)
assert "cinnamon bun" not in response.message.lower()

Asynchronous support

All methods support asynchronous programming. You can use the async/await syntax to interact with the assistant.

import asyncio
import firedust

async def main() -> None:
    assistant = await firedust.assistant.async_load(name="Sam")

    # add data
    await assistant.learn.fast("Gandalf is a good friend.")

    # chat
    response = await assistant.chat.message("Who is Gandalf?")
    assert "friend" in response.message.lower()

    # stream
    async for event in assistant.chat.stream("Who is Gandalf?"):
        print(event.message)

    # delete assistant
    await assistant.delete(confirm=True)

asyncio.run(main())

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

firedust-0.0.43.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

firedust-0.0.43-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file firedust-0.0.43.tar.gz.

File metadata

  • Download URL: firedust-0.0.43.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.19 Linux/6.6.12-linuxkit

File hashes

Hashes for firedust-0.0.43.tar.gz
Algorithm Hash digest
SHA256 0c7f74b1dd8af178c96ed99c0b873bd923db66247d8aeaa19a70bbe7cd4819b4
MD5 ab8838ed5e4a67bc9a7965437e1fdbf3
BLAKE2b-256 c19472db79386190d5899cc02d2512c6aa0be05b91092ca2b329d8c3167ac0ee

See more details on using hashes here.

File details

Details for the file firedust-0.0.43-py3-none-any.whl.

File metadata

  • Download URL: firedust-0.0.43-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.19 Linux/6.6.12-linuxkit

File hashes

Hashes for firedust-0.0.43-py3-none-any.whl
Algorithm Hash digest
SHA256 ab61fa8485f9c2aea26ecaa9471eac87f71862e82d9ef29c76f72c1d86b6dd9b
MD5 d40363c9af31603748bc4d5a9967a426
BLAKE2b-256 1c663407366c4f955d09d80a5cc8b99b8dee1e4a83348708a9dc86e3f2b0fc35

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