Can the assistants API read the metadata?

Did that update the instruction for your global assistant?

It only updated the instructions for the current Run. In the app I am using it, I switch the names depending on the user who sent the message in the same thread.

2 Likes

That’s a good technique then. I don’t have a great mechanism for that currently.

Hi, I need some help. Can we provide some default question to assistant that assistant can ask to user to get some user information like (name, email) . How we can do this?

The way I would do this is with the additional_instructions parameter of a run.

The reason is that the thread conversation history has a point where it will be truncated, and the AI quality of reading all at once isn’t great either, and you don’t want the user to be prompted multiple times for personal information.

You can have the additional instruction disabled when the AI has finally returned a tool call with the personal info, or after a number of turns.

The instructions themselves will just have the method and justification for pestering the user, along with prohibitions until provided.

As a curiosity, it seems like metadata can influence somehow the output generated by the Assistant.

For instance, if I start a conversation with the prompt “Hey,” I get a response in English:

However, if I add the metadata parameter "preferred_language": "es" to the run:

 $stream = $openAi->threads()->runs()->createStreamed(
            threadId: $thread->openai_id,
            parameters: [
                'assistant_id' => $thread->assistant->openai_id,
                'metadata' => [
                    'preferred_language' => 'es',
                ],
....

And write again “Hey” I get an answer in Spanish.

I wouldn’t rely on it too much, but found it interesting.

1 Like