Language

KnowledgeBaseRetrievalClient.RetrieveStreamAsync Method

Definition

Overloads

Name Description
RetrieveStreamAsync(RequestContent, String, String, RequestContext)

[Protocol Method] Retrieves relevant data from backing stores and streams progress and results as server-sent events. Process the response incrementally using server-sent event framing. Each event contains an event name and a JSON-encoded data payload. The stream ends with either a response.completed event or an error event. OpenAPI 2.0 represents the response body as a string, so generated clients may expose the raw response without typed event parsing. Do not deserialize the complete response body as a single JSON document.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
RetrieveStreamAsync(KnowledgeBaseRetrievalRequest, String, String, CancellationToken)

KnowledgeBase retrieves relevant data from backing stores, streaming progress and results as server-sent events on the same connection as they become available, instead of waiting for the full retrieval to complete.

RetrieveStreamAsync(RequestContent, String, String, RequestContext)

Source:
KnowledgeBaseRetrievalClient.cs

[Protocol Method] Retrieves relevant data from backing stores and streams progress and results as server-sent events. Process the response incrementally using server-sent event framing. Each event contains an event name and a JSON-encoded data payload. The stream ends with either a response.completed event or an error event. OpenAPI 2.0 represents the response body as a string, so generated clients may expose the raw response without typed event parsing. Do not deserialize the complete response body as a single JSON document.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<System.ClientModel.AsyncStreamingClientResult<System.Net.ServerSentEvents.SseItem<BinaryData>>> RetrieveStreamAsync(Azure.Core.RequestContent content, string querySourceAuthorization = default, string queryWorkIQSourceAuthorization = default, Azure.RequestContext context = default);
abstract member RetrieveStreamAsync : Azure.Core.RequestContent * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<System.ClientModel.AsyncStreamingClientResult<System.Net.ServerSentEvents.SseItem<BinaryData>>>
override this.RetrieveStreamAsync : Azure.Core.RequestContent * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<System.ClientModel.AsyncStreamingClientResult<System.Net.ServerSentEvents.SseItem<BinaryData>>>
Public Overridable Function RetrieveStreamAsync (content As RequestContent, Optional querySourceAuthorization As String = Nothing, Optional queryWorkIQSourceAuthorization As String = Nothing, Optional context As RequestContext = Nothing) As Task(Of AsyncStreamingClientResult(Of SseItem(Of BinaryData)))

Parameters

content
RequestContent

The content to send as the body of the request.

querySourceAuthorization
String

Token identifying the user for which the query is being executed. This token is used to enforce security restrictions on documents.

queryWorkIQSourceAuthorization
String

User assertion token for a customer-owned Entra app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication to the Work IQ API.

context
RequestContext

The request options, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Applies to

RetrieveStreamAsync(KnowledgeBaseRetrievalRequest, String, String, CancellationToken)

Source:
KnowledgeBaseRetrievalClient.cs

KnowledgeBase retrieves relevant data from backing stores, streaming progress and results as server-sent events on the same connection as they become available, instead of waiting for the full retrieval to complete.

public virtual System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalStreamEvent>> RetrieveStreamAsync(Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalRequest retrievalRequest, string querySourceAuthorization = default, string queryWorkIQSourceAuthorization = default, System.Threading.CancellationToken cancellationToken = default);
abstract member RetrieveStreamAsync : Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalRequest * string * string * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalStreamEvent>>
override this.RetrieveStreamAsync : Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalRequest * string * string * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<Azure.Search.Documents.KnowledgeBases.Models.KnowledgeBaseRetrievalStreamEvent>>
Public Overridable Function RetrieveStreamAsync (retrievalRequest As KnowledgeBaseRetrievalRequest, Optional querySourceAuthorization As String = Nothing, Optional queryWorkIQSourceAuthorization As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of SseItem(Of KnowledgeBaseRetrievalStreamEvent))

Parameters

retrievalRequest
KnowledgeBaseRetrievalRequest

The retrieval request to process.

querySourceAuthorization
String

Token identifying the user for which the query is being executed. This token is used to enforce security restrictions on documents.

queryWorkIQSourceAuthorization
String

User assertion token for a customer-owned Entra app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication to the Work IQ API.

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the request or stream enumeration.

Returns

The server-sent events returned by the service. The event name is available from EventType and the typed event payload is available from Data.

Exceptions

retrievalRequest is null.

Service returned a non-success status code.

The streaming response did not contain a content stream.

Applies to