HJi @Romanowski, Tomasz
In your code, the client.beta.assistants.create()
method seems to be trying to create a new assistant with each API call, which might not be the correct API usage. Instead, you should create the assistant on the OpenAI platform and then use the API to interact with the already-created assistant.
References:
https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/assistants
https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference
- Interacting with the Assistant: Once the assistant is created, you can use the API to send messages to the assistant and receive responses. This is typically done using the
client.chat.completions.create()
method in your code. - Assistant Tools: Assistants can access multiple tools in parallel. These tools can be Azure OpenAI-hosted tools like code interpreter and file search or tools you build, host, and access through function calls.
- Persistent Threads: The Assistants API supports persistent, automatically managed threads. As a developer, you no longer need to develop conversation state management systems and work around a model’s context window constraints.
If you find this response helpful and it resolves your issue, please consider marking it as “Accepted” or giving it an upvote. This will help others in the community find the solution more easily.