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

[BUG] Additional messages cannot be added when using CreateRunStreamingAsync or CreateRunAsync #47244

Closed
sandrohanea opened this issue Nov 19, 2024 · 3 comments
Assignees
Labels
AI Projects Client This issue points to a problem in the data-plane of the library.

Comments

@sandrohanea
Copy link

Library name and version

Azure.AI.Projects 1.0.0-alpha.20241114.1

Describe the bug

When trying to run an assistant turn, and add additional user messages in a single call, the SDK is not allowing it.

The reason is that additionalMessages property is of type IEnumerable<ThreadMessage> additionalMessages = null for both CreateRunStreamingAsync and CreateRunAsync

As an SDK user, I'm not able to construct that object (which requires Id, ThreadId, assistantId, etc) in order to store additional messages before running the thread run,

CreateMessageAsync is using less properties and can be called without these properties (Id, createddate, etc):
Image

Alternative, call the CreateMessageAsync before calling the CreateRunAsync():
Image

But this will result in unnecessary calls the Agent API.

Please, change the additionalMessages to a property similar with CreateMessageRequest (that is currently internal) in order to be able to send additional messages when running the agent response.

Expected behavior

It is expected to be able to add additional messages when creating the thread run.

Actual behavior

It is not possible to add the additional messages

Reproduction Steps

See above

Environment

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 19, 2024
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. AI Projects and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 19, 2024
@ShivangiReja
Copy link
Member

Hi @sandrohanea, Thank you for reporting this issue and sharing detailed reproduction steps.

The issue appears to be related to how the additionalMessages property is defined in the underlying TypeSpec. We haven’t manually created a type for this property, and it follows the schema defined in the TypeSpec file. You can review the spec for additionalMessages here:
TypeSpec Reference.

cc: @jhakulin @dargilco

@ShivangiReja
Copy link
Member

Here’s an alternate approach you can use to make it work:

In the C# SDK, we provide both convenience methods and protocol methods. The issue lies in the convenience method, where we use input and output models. However, you can still use the protocol method without any issues. Protocol methods allow you pass the raw request and retrieve the raw response directly.

You can call this protocol method:

Task<Response> CreateRunAsync(string threadId, RequestContent content, RequestContext context = null)

@ShivangiReja
Copy link
Member

Fixed: #47272

@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AI Projects Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

3 participants