Class ConversationsEndpoint
public sealed class ConversationsEndpoint : OpenAIBaseEndpoint
- Inheritance
-
ConversationsEndpoint
- Inherited Members
Constructors
ConversationsEndpoint(OpenAIClient)
public ConversationsEndpoint(OpenAIClient client)
Parameters
clientOpenAIClient
Properties
Root
The root endpoint address.
protected override string Root { get; }
Property Value
Methods
CreateConversationAsync(CreateConversationRequest, CancellationToken)
Create a conversation.
public Task<Conversation> CreateConversationAsync(CreateConversationRequest request, CancellationToken cancellationToken = default)
Parameters
requestCreateConversationRequestcancellationTokenCancellationTokenOptional, CancellationToken.
Returns
CreateConversationItemsAsync(string, IEnumerable<IResponseItem>, string[], CancellationToken)
Create items in a conversation with the given ID.
public Task<ListResponse<IResponseItem>> CreateConversationItemsAsync(string conversationId, IEnumerable<IResponseItem> items, string[] include = null, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe ID of the conversation to add the item to.
itemsIEnumerable<IResponseItem>The items to add to the conversation. You may add up to 20 items at a time.
includestring[]Optional, Additional fields to include in the response.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
DeleteConversationAsync(string, CancellationToken)
Delete a conversation.
public Task<bool> DeleteConversationAsync(string conversationId, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe id of the conversation to retrieve.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
- Task<bool>
True, if the Conversation was deleted successfully, otherwise False.
Remarks
Items in the conversation will not be deleted.
DeleteConversationItemAsync(string, string, CancellationToken)
Delete an item from a conversation with the given IDs.
public Task<Conversation> DeleteConversationItemAsync(string conversationId, string itemId, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe ID of the conversation that contains the item.
itemIdstringThe ID of the item to delete.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
- Task<Conversation>
Returns the updated Conversation>.
GetConversationAsync(string, CancellationToken)
Get a conversation.
public Task<Conversation> GetConversationAsync(string conversationId, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe id of the conversation to retrieve.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
GetConversationItemAsync(string, string, string[], CancellationToken)
Retrieve an item from a conversation.
public Task<IResponseItem> GetConversationItemAsync(string conversationId, string itemId, string[] include = null, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe ID of the conversation that contains the item.
itemIdstringThe ID of the item to retrieve.
includestring[]Optional, Additional fields to include in the response.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
ListConversationItemsAsync(string, ListQuery, CancellationToken)
List all items for a conversation with the given ID.
public Task<ListResponse<IResponseItem>> ListConversationItemsAsync(string conversationId, ListQuery query = null, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe ID of the conversation to list items for.
queryListQueryOptional, ListQuery.
cancellationTokenCancellationTokenOptional, CancellationToken.
Returns
UpdateConversationAsync(string, IReadOnlyDictionary<string, string>, CancellationToken)
Update a conversation.
public Task<Conversation> UpdateConversationAsync(string conversationId, IReadOnlyDictionary<string, string> metadata, CancellationToken cancellationToken = default)
Parameters
conversationIdstringThe id of the conversation to retrieve.
metadataIReadOnlyDictionary<string, string>Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters.Values are strings with a maximum length of 512 characters.
cancellationTokenCancellationTokenOptional, CancellationToken.