Support for OpenAI Assistant API.
This has been gradually extended over several releases, so summarizing here:
You can define a Langroid OpenAIAssistant as a subclass of ChatAgent.
These agents can be used as drop-in replacements for ChatAgent within tasks, and work seamlessly
with Langroid's task orchestration.
The OpenAIAssistant agent leverages several features of the OpenAI Assistant API:
* conversation state (so no need to maintain conv state as in ChatAgent)
* thread, assistant persistence with caching: thread_id, assistant_id are cached based on user/machine/org and can be resumed across sessions.
* Tools: Function-calling, Retrieval, Code-Interpreter
* File uploads
Until docs are ready, it's best to see these examples:
Tests:
* [test_openai_assistant.py](https://github.com/langroid/langroid/blob/main/tests/main/test_openai_assistant.py)
* [test_openai_assistant_async.py](https://github.com/langroid/langroid/blob/main/tests/main/test_openai_assistant_async.py)
Example scripts:
* [examples/basic/oai-asst-chat.py](https://github.com/langroid/langroid/blob/main/examples/basic/oai-asst-chat.py) The most basic simple chat
* [examples/basic/oai-code-chat.py](https://github.com/langroid/langroid/blob/main/examples/basic/oai-code-chat.py) Chat with code interpreter.
* [examples/docqa/oai-retrieval-assistant.py](https://github.com/langroid/langroid/blob/main/examples/docqa/oai-retrieval-assistant.py) Basic retrieval
(RAG) chat.
* [examples/docqa/oai-retrieval-2.py](https://github.com/langroid/langroid/blob/main/examples/docqa/oai-retrieval-2.py) 2-agent chat with retrieval