Dynamic AssistantId Setting #82
Replies: 2 comments
-
Hello @drkfmorton , thank you for using the library and for your kind words! Yes, you can dynamically set the assistant ID after loading it from the .env file. Here's an outline of how you can achieve this: Step 1: Import the AssistantModuleYou can import the Step 2: Creating an AssistantHere’s an example of how you can create an assistant instance: import { AiService } from '@boldare/openai-assistant';
....
constructor(private readonly aiService: AiService) {}
create() {
const assistant = this.aiService.provider.beta.assistants.create({
... // config
});
// Now you can use your assistant to the next actions
} Step 3: API Reference and payload detailsThen can create the thread and pass the assistant ID when you want to send the message:
This approach allows you to dynamically load the assistant ID and use it throughout your application. Let us know if you need further assistance! :) |
Beta Was this translation helpful? Give feedback.
-
Thank you!!!! |
Beta Was this translation helpful? Give feedback.
-
Hi,
First off, thank you for such amazing work. As I am using the library, I am wondering if there is a way to dynamically set the assistant Id after it loads from the .env file?
Beta Was this translation helpful? Give feedback.
All reactions