Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateThreadAndRunAsync does not use RunCreationOptions.AdditionalInstructions #77

Open
Blackbaud-TimMcVicker opened this issue Jun 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Blackbaud-TimMcVicker
Copy link

Calling CreateThreadAndRunAsync with a RunCreationOptions parameter that sets AdditionalInstructions does not set that on the actual run. Creating the Thread and Run separately works correctly.

Package version: OpenAI 2.0.0-beta.5.

In both of the following examples, the Instructions on my assistant are "Be serious".

The following code results in a threadRun with Instructions set to “Be serious”:

var threadRun = await assistantClient.CreateThreadAndRunAsync(assistant, new ThreadCreationOptions
{
    InitialMessages =
    {
        new ThreadInitializationMessage(
            new List<MessageContent>
            {
                request.InitialMessage
            })
    },
}, new RunCreationOptions
{
    AdditionalInstructions = "You need to be funny."
});

The following code results in a threadRun with Instructions set to “Be serious You need to be funny.”:

var thread = await assistantClient.CreateThreadAsync(new ThreadCreationOptions
{
    InitialMessages =
    {
        new ThreadInitializationMessage(
            new List<MessageContent>
            {
                request.InitialMessage
            })
    },
}, cancellationToken);

var threadRun = await assistantClient.CreateRunAsync(thread.Value.Id, assistant.Id, new RunCreationOptions
{
    AdditionalInstructions = "You need to be funny."
}, cancellationToken);
@KrzysztofCwalina KrzysztofCwalina added the bug Something isn't working label Jun 20, 2024
@trrwilson
Copy link
Collaborator

Thanks, @Blackbaud-TimMcVicker, great find!

The root of this issue is that AdditionalInstructions isn't part of the specified request body parameters for the operation, as you can see in the API reference -- I strongly suspect this was just an oversight (AdditionalInstructions was added a bit later) and hope that'll get addressed; it makes much more sense for CreateThreadAndRun to take options for a thread and options for a run than it does to have an entirely new options type that just selectively omits one thing!

In the interim while that discrepancy is still being resolved at the spec level, you can of course create the thread and run separately -- the CreateThread operation does properly honor the AdditionalInstructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants