Table of Contents

Class AssistantResponse

Namespace
OpenAI.Assistants
Assembly
OpenAI-DotNet.dll

Purpose-built AI that uses OpenAI's models and calls tools.

public sealed class AssistantResponse : BaseResponse
Inheritance
AssistantResponse
Inherited Members
Extension Methods

Properties

CreatedAt

[JsonIgnore]
public DateTime CreatedAt { get; }

Property Value

DateTime

CreatedAtUnixTimeSeconds

The Unix timestamp (in seconds) for when the assistant was created.

[JsonInclude]
[JsonPropertyName("created_at")]
public int CreatedAtUnixTimeSeconds { get; }

Property Value

int

Description

The description of the assistant. The maximum length is 512 characters.

[JsonInclude]
[JsonPropertyName("description")]
public string Description { get; }

Property Value

string

Id

The identifier, which can be referenced in API endpoints.

[JsonInclude]
[JsonPropertyName("id")]
public string Id { get; }

Property Value

string

Instructions

The system instructions that the assistant uses. The maximum length is 32768 characters.

[JsonInclude]
[JsonPropertyName("instructions")]
public string Instructions { get; }

Property Value

string

Metadata

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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.

[JsonInclude]
[JsonPropertyName("metadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyDictionary<string, string> Metadata { get; }

Property Value

IReadOnlyDictionary<string, string>

Model

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

[JsonInclude]
[JsonPropertyName("model")]
public string Model { get; }

Property Value

string

Name

The name of the assistant. The maximum length is 256 characters.

[JsonInclude]
[JsonPropertyName("name")]
public string Name { get; }

Property Value

string

Object

The object type, which is always assistant.

[JsonInclude]
[JsonPropertyName("object")]
public string Object { get; }

Property Value

string

ReasoningEffort

Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

[JsonInclude]
[JsonPropertyName("reasoning_effort")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ReasoningEffort ReasoningEffort { get; }

Property Value

ReasoningEffort

ResponseFormat

[JsonIgnore]
public ChatResponseFormat ResponseFormat { get; }

Property Value

ChatResponseFormat

ResponseFormatObject

Specifies the format that the model must output. Setting to Json or JsonSchema enables JSON mode, which guarantees the message the model generates is valid JSON.

[JsonInclude]
[JsonPropertyName("response_format")]
[JsonConverter(typeof(ResponseFormatConverter))]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ResponseFormatObject ResponseFormatObject { get; }

Property Value

ResponseFormatObject

Remarks

Important: When using JSON mode you must still instruct the model to produce JSON yourself via some conversation message, for example via your system message. If you don't do this, the model may generate an unending stream of whitespace until the generation reaches the token limit, which may take a lot of time and give the appearance of a "stuck" request. Also note that the message content may be partial (i.e. cut off) if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

Temperature

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

[JsonInclude]
[JsonPropertyName("temperature")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Temperature { get; }

Property Value

double?

ToolResources

A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs.

[JsonInclude]
[JsonPropertyName("tool_resources")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ToolResources ToolResources { get; }

Property Value

ToolResources

Tools

A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types 'code_interpreter', 'retrieval', or 'function'.

[JsonInclude]
[JsonPropertyName("tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<Tool> Tools { get; }

Property Value

IReadOnlyList<Tool>

TopP

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

[JsonInclude]
[JsonPropertyName("top_p")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? TopP { get; }

Property Value

double?

Methods

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

implicit operator string(AssistantResponse)

public static implicit operator string(AssistantResponse assistant)

Parameters

assistant AssistantResponse

Returns

string