This is a FastAPI micro that allows a web app like Telegram, Streamlit, Trello, and others connect with any any OpenAI Assistant.
The Assistants API simplifies building assistants by managing conversation history, retrieval-augmented generation (RAG), and tool calling for you. We've made several improvements, including knowledge retrieval with up to 10,000 files per assistant, customisable file chunking, an integrated vector store, token controls, support for streaming and fine-tuned models, and additional parameters in the API.
Presently, the services allows you to :
- get details of the Assistant
- create a new thread
- delete a thread
- chat with the Assistant
- get list of files in Assistant
- receive file created in Assistant
- (more to be added in near future)
It supports all the tools available on an Assistant code_interpreter
and file_search
, or call a third-party tools via a function
calling including the ability to add additional instructions. The actual code for the functions need to be added as these would be specific your use case.
Telegram
For the demo setup on Telegram, a /assistant command is used to initiate a thread. The thread_id is kept with the user Telegram id in AWS Dynamodb along with other app data. /disconnect command is used to delete the thread_id, thus allowing a new thread to be created. The thread persistency allows chat history to provide context, if required, to able ChatGPT provide the most appropriate response message
Streamlit
For the demo setup on with Streamlit, the chat with a OpenAI Assistant is implemented as an app in a multi page app authenticated user environment. In this case, the authentication is via AWS Cognito which include social login.
Trello
The same micro is used in my own Trello CRM to summarise email reply history and using it to provide context to recommend a reply. The message is created as a comment that the user can the use it to reply from the same card.
Web App
Likewise, with a bit more work the same Assistant (micro) can be connected to your web app.
In this case, this is a Sveltekit app using TalkJs create a page where you can have chat with different Assistants. For example, it can be an employee workforce page covering different topics relating to HR matters.
Shown above in the protected zone that the employee will have access after authenticated by AWS Cognito. Here to create a personal free, "Abby Klein" is actually a bot that is implemented using a micro that connects to the OpenAI Assistant instance.