OpenAi.Assistants (OpenAI REST API Client v0.2.1)
Provides API endpoints related to assistants
Summary
Functions
Cancels a run that is in_progress
.
Create an assistant with a model and instructions.
Create a message.
Create a run.
Create a thread.
Create a thread and run it in one request.
Delete an assistant.
Deletes a message.
Delete a thread.
Retrieves an assistant.
Retrieve a message.
Retrieves a run.
Retrieves a run step.
Retrieves a thread.
Returns a list of assistants.
Returns a list of messages for a given thread.
Returns a list of run steps belonging to a run.
Returns a list of runs belonging to a thread.
Modifies an assistant.
Modifies a message.
Modifies a run.
Modifies a thread.
When a run has the status: "requires_action"
and required_action.type
is submit_tool_outputs
, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
Functions
cancel_run(thread_id, run_id, opts \\ [])
@spec cancel_run(String.t(), String.t(), keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Cancels a run that is in_progress
.
create_assistant(body, opts \\ [])
@spec create_assistant( OpenAi.Assistant.CreateRequest.t(), keyword() ) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Create an assistant with a model and instructions.
create_message(thread_id, body, opts \\ [])
@spec create_message(String.t(), OpenAi.Message.CreateRequest.t(), keyword()) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Create a message.
create_run(thread_id, body, opts \\ [])
@spec create_run(String.t(), OpenAi.Run.CreateRequest.t(), keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Create a run.
create_thread(body, opts \\ [])
@spec create_thread( OpenAi.Thread.CreateRequest.t(), keyword() ) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Create a thread.
create_thread_and_run(body, opts \\ [])
@spec create_thread_and_run( OpenAi.Thread.CreateAndRunRequest.t(), keyword() ) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Create a thread and run it in one request.
delete_assistant(assistant_id, opts \\ [])
@spec delete_assistant( String.t(), keyword() ) :: {:ok, OpenAi.Assistant.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Delete an assistant.
delete_message(thread_id, message_id, opts \\ [])
@spec delete_message(String.t(), String.t(), keyword()) :: {:ok, OpenAi.Message.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Deletes a message.
delete_thread(thread_id, opts \\ [])
@spec delete_thread( String.t(), keyword() ) :: {:ok, OpenAi.Thread.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Delete a thread.
get_assistant(assistant_id, opts \\ [])
@spec get_assistant( String.t(), keyword() ) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Retrieves an assistant.
get_message(thread_id, message_id, opts \\ [])
@spec get_message(String.t(), String.t(), keyword()) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Retrieve a message.
get_run(thread_id, run_id, opts \\ [])
@spec get_run(String.t(), String.t(), keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Retrieves a run.
get_run_step(thread_id, run_id, step_id, opts \\ [])
@spec get_run_step(String.t(), String.t(), String.t(), keyword()) :: {:ok, OpenAi.Run.Step.t()} | {:error, OpenAi.Error.error()}
Retrieves a run step.
get_thread(thread_id, opts \\ [])
@spec get_thread( String.t(), keyword() ) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Retrieves a thread.
list_assistants(opts \\ [])
@spec list_assistants(keyword()) :: {:ok, OpenAi.Assistant.ListResponse.t()} | {:error, OpenAi.Error.error()}
Returns a list of assistants.
Options
limit
: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order
: Sort order by thecreated_at
timestamp of the objects.asc
for ascending order anddesc
for descending order.after
: A cursor for use in pagination.after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before
: A cursor for use in pagination.before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
list_messages(thread_id, opts \\ [])
@spec list_messages( String.t(), keyword() ) :: {:ok, OpenAi.Message.ListResponse.t()} | {:error, OpenAi.Error.error()}
Returns a list of messages for a given thread.
Options
limit
: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order
: Sort order by thecreated_at
timestamp of the objects.asc
for ascending order anddesc
for descending order.after
: A cursor for use in pagination.after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before
: A cursor for use in pagination.before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.run_id
: Filter messages by the run ID that generated them.
list_run_steps(thread_id, run_id, opts \\ [])
@spec list_run_steps(String.t(), String.t(), keyword()) :: {:ok, OpenAi.Run.Step.ListResponse.t()} | {:error, OpenAi.Error.error()}
Returns a list of run steps belonging to a run.
Options
limit
: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order
: Sort order by thecreated_at
timestamp of the objects.asc
for ascending order anddesc
for descending order.after
: A cursor for use in pagination.after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before
: A cursor for use in pagination.before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
list_runs(thread_id, opts \\ [])
@spec list_runs( String.t(), keyword() ) :: {:ok, OpenAi.Run.ListResponse.t()} | {:error, OpenAi.Error.error()}
Returns a list of runs belonging to a thread.
Options
limit
: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order
: Sort order by thecreated_at
timestamp of the objects.asc
for ascending order anddesc
for descending order.after
: A cursor for use in pagination.after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before
: A cursor for use in pagination.before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
modify_assistant(assistant_id, body, opts \\ [])
@spec modify_assistant(String.t(), OpenAi.Assistant.UpdateRequest.t(), keyword()) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Modifies an assistant.
modify_message(thread_id, message_id, body, opts \\ [])
@spec modify_message( String.t(), String.t(), OpenAi.Message.UpdateRequest.t(), keyword() ) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Modifies a message.
modify_run(thread_id, run_id, body, opts \\ [])
@spec modify_run(String.t(), String.t(), OpenAi.Run.UpdateRequest.t(), keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Modifies a run.
modify_thread(thread_id, body, opts \\ [])
@spec modify_thread(String.t(), OpenAi.Thread.UpdateRequest.t(), keyword()) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Modifies a thread.
submit_tool_ouputs_to_run(thread_id, run_id, body, opts \\ [])
@spec submit_tool_ouputs_to_run( String.t(), String.t(), OpenAi.Assistant.Tool.Outputs.RunSubmitRequest.t(), keyword() ) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
When a run has the status: "requires_action"
and required_action.type
is submit_tool_outputs
, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.