Skip to content

Commit 3901640

Browse files
authored
add missing list_responses API to Projects-level responses client (#53952)
1 parent 8718bc5 commit 3901640

14 files changed

+264
-24
lines changed

sdk/ai/Azure.AI.Projects.OpenAI/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release History
22

3+
## 1.0.0-beta.3 (Unreleased)
4+
5+
### Features Added
6+
7+
- `ProjectResponsesClient.GetProjectResponses()` is added, supporting the ability to list previous responses with optional agent and conversation filters.
8+
9+
### Breaking Changes (beta)
10+
11+
- `ProjectConversationsClient.GetProjectConversations()` has an updated signature that accepts an `AgentReference` instead of distinct `agentName` and `agentId` parameters, aligned with the new "list responses" operation.
12+
313
## 1.0.0-beta.2 (2025-11-14)
414

515
### Bugs fixed

sdk/ai/Azure.AI.Projects.OpenAI/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,17 @@ Finally, we can delete Agent.
230230
await projectClient.Agents.DeleteAgentAsync(agentName: "myAgent");
231231
```
232232

233-
#### Coversations
233+
Previously created responses can also be listed, typically to find all responses associated with a particular agent or conversation.
234+
235+
```C# Snippet:Sample_ListResponses_Async
236+
await foreach (OpenAIResponse response
237+
in projectClient.OpenAI.Responses.GetProjectResponsesAsync(agent: new AgentReference(agentName), conversationId: conversationId))
238+
{
239+
Console.WriteLine($"Matching response: {response.Id}");
240+
}
241+
```
242+
243+
#### Conversations
234244

235245
Conversations may be used to store the history of interaction with the agent. To add the responses to a conversation,
236246
set the conversation parameter while calling `GetProjectResponsesClientForAgent`.

sdk/ai/Azure.AI.Projects.OpenAI/api/Azure.AI.Projects.OpenAI.net8.0.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,8 @@ public ProjectConversationsClient(System.ClientModel.Primitives.ClientPipeline p
11321132
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.AgentResponseItem>> GetProjectConversationItemAsync(string conversationId, string itemId, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11331133
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.AgentResponseItem> GetProjectConversationItems(string conversationId, Azure.AI.Projects.OpenAI.AgentResponseItemKind? itemKind = default(Azure.AI.Projects.OpenAI.AgentResponseItemKind?), int? limit = default(int?), string order = null, string after = null, string before = null, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11341134
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.AgentResponseItem> GetProjectConversationItemsAsync(string conversationId, Azure.AI.Projects.OpenAI.AgentResponseItemKind? itemKind = default(Azure.AI.Projects.OpenAI.AgentResponseItemKind?), int? limit = default(int?), string order = null, string after = null, string before = null, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1135-
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversations(int? limit = default(int?), string order = null, string after = null, string before = null, string agentName = null, string agentId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1136-
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversationsAsync(int? limit = default(int?), string order = null, string after = null, string before = null, string agentName = null, string agentId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1135+
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversations(Azure.AI.Projects.OpenAI.AgentReference agent = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1136+
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversationsAsync(Azure.AI.Projects.OpenAI.AgentReference agent = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11371137
public virtual System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.ProjectConversation> UpdateProjectConversation(string conversationId, Azure.AI.Projects.OpenAI.ProjectConversationUpdateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11381138
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.ProjectConversation>> UpdateProjectConversationAsync(string conversationId, Azure.AI.Projects.OpenAI.ProjectConversationUpdateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11391139
}
@@ -1198,6 +1198,8 @@ public ProjectResponsesClient(System.Uri projectEndpoint, System.ClientModel.Aut
11981198
public override System.ClientModel.CollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreaming(string userInputText, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11991199
public override System.ClientModel.AsyncCollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreamingAsync(System.Collections.Generic.IEnumerable<OpenAI.Responses.ResponseItem> inputItems, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
12001200
public override System.ClientModel.AsyncCollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreamingAsync(string userInputText, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1201+
public virtual System.ClientModel.CollectionResult<OpenAI.Responses.OpenAIResponse> GetProjectResponses(Azure.AI.Projects.OpenAI.AgentReference agent = null, string conversationId = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1202+
public virtual System.ClientModel.AsyncCollectionResult<OpenAI.Responses.OpenAIResponse> GetProjectResponsesAsync(Azure.AI.Projects.OpenAI.AgentReference agent = null, string conversationId = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
12011203
}
12021204
public partial class ProjectResponsesClientOptions : Azure.AI.Projects.OpenAI.ProjectOpenAIClientOptions
12031205
{

sdk/ai/Azure.AI.Projects.OpenAI/api/Azure.AI.Projects.OpenAI.netstandard2.0.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,8 @@ public ProjectConversationsClient(System.ClientModel.Primitives.ClientPipeline p
11321132
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.AgentResponseItem>> GetProjectConversationItemAsync(string conversationId, string itemId, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11331133
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.AgentResponseItem> GetProjectConversationItems(string conversationId, Azure.AI.Projects.OpenAI.AgentResponseItemKind? itemKind = default(Azure.AI.Projects.OpenAI.AgentResponseItemKind?), int? limit = default(int?), string order = null, string after = null, string before = null, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11341134
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.AgentResponseItem> GetProjectConversationItemsAsync(string conversationId, Azure.AI.Projects.OpenAI.AgentResponseItemKind? itemKind = default(Azure.AI.Projects.OpenAI.AgentResponseItemKind?), int? limit = default(int?), string order = null, string after = null, string before = null, System.Collections.Generic.IEnumerable<OpenAI.Conversations.IncludedConversationItemProperty> include = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1135-
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversations(int? limit = default(int?), string order = null, string after = null, string before = null, string agentName = null, string agentId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1136-
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversationsAsync(int? limit = default(int?), string order = null, string after = null, string before = null, string agentName = null, string agentId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1135+
public virtual System.ClientModel.CollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversations(Azure.AI.Projects.OpenAI.AgentReference agent = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1136+
public virtual System.ClientModel.AsyncCollectionResult<Azure.AI.Projects.OpenAI.ProjectConversation> GetProjectConversationsAsync(Azure.AI.Projects.OpenAI.AgentReference agent = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11371137
public virtual System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.ProjectConversation> UpdateProjectConversation(string conversationId, Azure.AI.Projects.OpenAI.ProjectConversationUpdateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11381138
public virtual System.Threading.Tasks.Task<System.ClientModel.ClientResult<Azure.AI.Projects.OpenAI.ProjectConversation>> UpdateProjectConversationAsync(string conversationId, Azure.AI.Projects.OpenAI.ProjectConversationUpdateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11391139
}
@@ -1198,6 +1198,8 @@ public ProjectResponsesClient(System.Uri projectEndpoint, System.ClientModel.Aut
11981198
public override System.ClientModel.CollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreaming(string userInputText, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
11991199
public override System.ClientModel.AsyncCollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreamingAsync(System.Collections.Generic.IEnumerable<OpenAI.Responses.ResponseItem> inputItems, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
12001200
public override System.ClientModel.AsyncCollectionResult<OpenAI.Responses.StreamingResponseUpdate> CreateResponseStreamingAsync(string userInputText, OpenAI.Responses.ResponseCreationOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1201+
public virtual System.ClientModel.CollectionResult<OpenAI.Responses.OpenAIResponse> GetProjectResponses(Azure.AI.Projects.OpenAI.AgentReference agent = null, string conversationId = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
1202+
public virtual System.ClientModel.AsyncCollectionResult<OpenAI.Responses.OpenAIResponse> GetProjectResponsesAsync(Azure.AI.Projects.OpenAI.AgentReference agent = null, string conversationId = null, int? limit = default(int?), string order = null, string after = null, string before = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
12011203
}
12021204
public partial class ProjectResponsesClientOptions : Azure.AI.Projects.OpenAI.ProjectOpenAIClientOptions
12031205
{

sdk/ai/Azure.AI.Projects.OpenAI/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/ai/Azure.AI.Projects.OpenAI",
5-
"Tag": "net/ai/Azure.AI.Projects.OpenAI_ded29b1e2c"
5+
"Tag": "net/ai/Azure.AI.Projects.OpenAI_8a364fa4af"
66
}

sdk/ai/Azure.AI.Projects.OpenAI/src/Custom/Internal/InternalOpenAICollectionResultOptions.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ internal partial class InternalOpenAICollectionResultOptions
1616
public string BeforeId { get; set; }
1717
public List<string> Filters { get; } = [];
1818
public List<string> Includes { get; } = [];
19+
public Dictionary<string, string> ExtraQueryMap { get; } = [];
1920

20-
public InternalOpenAICollectionResultOptions(int? limit = null, string order = null, string after = null, string before = null, IEnumerable<string> filters = null, IEnumerable<string> includes = null)
21+
public InternalOpenAICollectionResultOptions(int? limit = null, string order = null, string after = null, string before = null, IEnumerable<string> filters = null, IEnumerable<string> includes = null, IReadOnlyDictionary<string, string> extraQueryMap = null)
2122
{
2223
Limit = limit;
2324
Order = order;
@@ -39,16 +40,32 @@ public InternalOpenAICollectionResultOptions(int? limit = null, string order = n
3940
Includes.Add(maybeInclude);
4041
}
4142
}
43+
ExtraQueryMap ??= [];
44+
if (extraQueryMap is not null)
45+
{
46+
foreach (KeyValuePair<string, string> pair in extraQueryMap)
47+
{
48+
ExtraQueryMap.Add(pair.Key, pair.Value);
49+
}
50+
}
4251
}
4352

4453
public InternalOpenAICollectionResultOptions GetCloneForPage<T>(InternalOpenAIPaginatedListResultOfT<T> page)
4554
{
46-
InternalOpenAICollectionResultOptions clonedOptions = (InternalOpenAICollectionResultOptions)MemberwiseClone();
55+
InternalOpenAICollectionResultOptions clonedOptions = new()
56+
{
57+
ParentResourceId = ParentResourceId,
58+
Limit = Limit,
59+
Order = Order,
60+
AfterId = AfterId,
61+
BeforeId = BeforeId,
62+
};
4763
clonedOptions.Filters.AddRange(Filters);
4864
clonedOptions.Includes.AddRange(Includes);
49-
50-
clonedOptions.AfterId = page.LastId;
51-
clonedOptions.BeforeId = page.FirstId;
65+
foreach (KeyValuePair<string, string> pair in ExtraQueryMap)
66+
{
67+
clonedOptions.ExtraQueryMap.Add(pair.Key, pair.Value);
68+
}
5269

5370
return clonedOptions;
5471
}

sdk/ai/Azure.AI.Projects.OpenAI/src/Custom/OpenAI/ProjectConversationUpdateOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using Azure.AI.Projects.OpenAI;
5-
64
namespace Azure.AI.Projects.OpenAI;
75

86
[CodeGenType("UpdateConversationRequest")]

sdk/ai/Azure.AI.Projects.OpenAI/src/Custom/OpenAI/ProjectConversationsClient.RestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public partial class ProjectConversationsClient : ConversationClient
1818
private static PipelineMessageClassifier _pipelineMessageClassifier200;
1919
private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = PipelineMessageClassifier.Create(stackalloc ushort[] { 200 });
2020

21-
internal PipelineMessage CreateGetProjectConversationsRequest(int? limit, string order, string after, string before, string agentName, string agentId, RequestOptions options)
21+
internal virtual PipelineMessage CreateGetProjectConversationsRequest(int? limit, string order, string after, string before, string agentName, string agentId, RequestOptions options)
2222
{
2323
ClientUriBuilder uri = new ClientUriBuilder();
2424
uri.Reset(_endpoint);

0 commit comments

Comments
 (0)