View Source OpenAi.Assistants (OpenAI REST API Client v1.0.0)
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
@spec cancel_run(thread_id :: String.t(), run_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Cancels a run that is in_progress.
@spec create_assistant(body :: OpenAi.Assistant.CreateRequest.t(), opts :: keyword()) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Create an assistant with a model and instructions.
@spec create_message( thread_id :: String.t(), body :: OpenAi.Message.CreateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Create a message.
@spec create_run( thread_id :: String.t(), body :: OpenAi.Run.CreateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Create a run.
Options
include[]: A list of additional fields to include in the response. Currently the only supported value isstep_details.tool_calls[*].file_search.results[*].contentto fetch the file search result content.See the file search tool documentation for more information.
@spec create_thread(body :: OpenAi.Thread.CreateRequest.t(), opts :: keyword()) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Create a thread.
@spec create_thread_and_run( body :: OpenAi.Thread.CreateAndRunRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Create a thread and run it in one request.
@spec delete_assistant(assistant_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Assistant.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Delete an assistant.
@spec delete_message( thread_id :: String.t(), message_id :: String.t(), opts :: keyword() ) :: {:ok, OpenAi.Message.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Deletes a message.
@spec delete_thread(thread_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Thread.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Delete a thread.
@spec get_assistant(assistant_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Retrieves an assistant.
@spec get_message( thread_id :: String.t(), message_id :: String.t(), opts :: keyword() ) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Retrieve a message.
@spec get_run(thread_id :: String.t(), run_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Retrieves a run.
@spec get_run_step( thread_id :: String.t(), run_id :: String.t(), step_id :: String.t(), opts :: keyword() ) :: {:ok, OpenAi.Run.Step.t()} | {:error, OpenAi.Error.error()}
Retrieves a run step.
Options
include[]: A list of additional fields to include in the response. Currently the only supported value isstep_details.tool_calls[*].file_search.results[*].contentto fetch the file search result content.See the file search tool documentation for more information.
@spec get_thread(thread_id :: String.t(), opts :: keyword()) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Retrieves a thread.
@spec list_assistants(opts :: 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_attimestamp of the objects.ascfor ascending order anddescfor descending order.after: A cursor for use in pagination.afteris 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.beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
@spec list_messages(thread_id :: String.t(), opts :: 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_attimestamp of the objects.ascfor ascending order anddescfor descending order.after: A cursor for use in pagination.afteris 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.beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting 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.
@spec list_run_steps(thread_id :: String.t(), run_id :: String.t(), opts :: 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_attimestamp of the objects.ascfor ascending order anddescfor descending order.after: A cursor for use in pagination.afteris 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.beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.include[]: A list of additional fields to include in the response. Currently the only supported value isstep_details.tool_calls[*].file_search.results[*].contentto fetch the file search result content.See the file search tool documentation for more information.
@spec list_runs(thread_id :: String.t(), opts :: 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_attimestamp of the objects.ascfor ascending order anddescfor descending order.after: A cursor for use in pagination.afteris 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.beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.
@spec modify_assistant( assistant_id :: String.t(), body :: OpenAi.Assistant.UpdateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Assistant.t()} | {:error, OpenAi.Error.error()}
Modifies an assistant.
@spec modify_message( thread_id :: String.t(), message_id :: String.t(), body :: OpenAi.Message.UpdateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Message.t()} | {:error, OpenAi.Error.error()}
Modifies a message.
@spec modify_run( thread_id :: String.t(), run_id :: String.t(), body :: OpenAi.Run.UpdateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Run.t()} | {:error, OpenAi.Error.error()}
Modifies a run.
@spec modify_thread( thread_id :: String.t(), body :: OpenAi.Thread.UpdateRequest.t(), opts :: keyword() ) :: {:ok, OpenAi.Thread.t()} | {:error, OpenAi.Error.error()}
Modifies a thread.
@spec submit_tool_outputs_to_run( thread_id :: String.t(), run_id :: String.t(), body :: OpenAi.Assistant.Tool.Outputs.RunSubmitRequest.t(), opts :: 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.