Table of Contents

Class ToolCall

Namespace
OpenAI.Threads
Assembly
OpenAI-DotNet.dll
public sealed class ToolCall : IToolCall
Inheritance
ToolCall
Implements
Inherited Members

Constructors

ToolCall()

public ToolCall()

ToolCall(string, string, string)

public ToolCall(string callId, string name, string arguments = null)

Parameters

callId string
name string
arguments string

Properties

Arguments

[JsonIgnore]
public JsonNode Arguments { get; }

Property Value

JsonNode

CallId

[JsonIgnore]
public string CallId { get; }

Property Value

string

CodeInterpreter

The Code Interpreter tool call definition.

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

Property Value

CodeInterpreter

FileSearch

The File Search tool call definition.

[JsonInclude]
[JsonPropertyName("file_search")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyDictionary<string, object> FileSearch { get; }

Property Value

IReadOnlyDictionary<string, object>

Remarks

For now, this is always going to be an empty object.

FunctionCall

The definition of the function that was called.

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

Property Value

FunctionCall

Id

The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the Submit tool outputs to run endpoint.

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

Property Value

string

Index

[JsonInclude]
[JsonPropertyName("index")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? Index { get; }

Property Value

int?

IsFunction

[JsonIgnore]
public bool IsFunction { get; }

Property Value

bool

Name

[JsonIgnore]
public string Name { get; }

Property Value

string

Type

The type of tool call the output is required for.

[JsonInclude]
[JsonPropertyName("type")]
public string Type { get; }

Property Value

string

Methods

AppendFrom(ToolCall)

public void AppendFrom(ToolCall other)

Parameters

other ToolCall

InvokeFunction()

public string InvokeFunction()

Returns

string

InvokeFunctionAsync(CancellationToken)

public Task<string> InvokeFunctionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<string>

InvokeFunctionAsync<T>(CancellationToken)

public Task<T> InvokeFunctionAsync<T>(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<T>

Type Parameters

T

InvokeFunction<T>()

public T InvokeFunction<T>()

Returns

T

Type Parameters

T