View Source OpenAi.Responses (OpenAI REST API Client v1.0.0)

Provides API endpoints related to responses

Summary

Functions

Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call your own custom code or use built-in tools like web search or file search to use your own data as input for the model's response.

Deletes a model response with the given ID.

Retrieves a model response with the given ID.

Returns a list of input items for a given response.

Functions

Link to this function

create_response(body, opts \\ [])

View Source
@spec create_response(body :: OpenAi.Response.Create.t(), opts :: keyword()) ::
  {:ok,
   OpenAi.Response.t()
   | OpenAi.Response.Audio.DeltaEvent.t()
   | OpenAi.Response.Audio.DoneEvent.t()
   | OpenAi.Response.Audio.Transcript.DeltaEvent.t()
   | OpenAi.Response.Audio.Transcript.DoneEvent.t()
   | OpenAi.Response.CodeInterpreter.Call.Code.DeltaEvent.t()
   | OpenAi.Response.CodeInterpreter.Call.Code.DoneEvent.t()
   | OpenAi.Response.CodeInterpreter.Call.CompletedEvent.t()
   | OpenAi.Response.CodeInterpreter.Call.InProgressEvent.t()
   | OpenAi.Response.CodeInterpreter.Call.InterpretingEvent.t()
   | OpenAi.Response.CompletedEvent.t()
   | OpenAi.Response.ContentPart.AddedEvent.t()
   | OpenAi.Response.ContentPart.DoneEvent.t()
   | OpenAi.Response.CreatedEvent.t()
   | OpenAi.Response.ErrorEvent.t()
   | OpenAi.Response.FailedEvent.t()
   | OpenAi.Response.FileSearch.Call.CompletedEvent.t()
   | OpenAi.Response.FileSearch.Call.InProgressEvent.t()
   | OpenAi.Response.FileSearch.Call.SearchingEvent.t()
   | OpenAi.Response.Function.Call.ArgumentsDeltaEvent.t()
   | OpenAi.Response.Function.Call.ArgumentsDoneEvent.t()
   | OpenAi.Response.InProgressEvent.t()
   | OpenAi.Response.IncompleteEvent.t()
   | OpenAi.Response.Output.Item.AddedEvent.t()
   | OpenAi.Response.Output.Item.DoneEvent.t()
   | OpenAi.Response.Reasoning.Summary.Part.AddedEvent.t()
   | OpenAi.Response.Reasoning.Summary.Part.DoneEvent.t()
   | OpenAi.Response.Reasoning.Summary.Text.DeltaEvent.t()
   | OpenAi.Response.Reasoning.Summary.Text.DoneEvent.t()
   | OpenAi.Response.Refusal.DeltaEvent.t()
   | OpenAi.Response.Refusal.DoneEvent.t()
   | OpenAi.Response.Text.AnnotationDeltaEvent.t()
   | OpenAi.Response.Text.DeltaEvent.t()
   | OpenAi.Response.Text.DoneEvent.t()
   | OpenAi.Response.WebSearch.Call.CompletedEvent.t()
   | OpenAi.Response.WebSearch.Call.InProgressEvent.t()
   | OpenAi.Response.WebSearch.Call.SearchingEvent.t()}
  | {:error, OpenAi.Error.error()}

Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call your own custom code or use built-in tools like web search or file search to use your own data as input for the model's response.

Link to this function

delete_response(response_id, opts \\ [])

View Source
@spec delete_response(response_id :: String.t(), opts :: keyword()) ::
  :ok | {:error, OpenAi.Error.error()}

Deletes a model response with the given ID.

Link to this function

get_response(response_id, opts \\ [])

View Source
@spec get_response(response_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Response.t()} | {:error, OpenAi.Error.error()}

Retrieves a model response with the given ID.

Options

  • include: Additional fields to include in the response. See the include parameter for Response creation above for more information.
Link to this function

list_input_items(response_id, opts \\ [])

View Source
@spec list_input_items(response_id :: String.t(), opts :: keyword()) ::
  {:ok, OpenAi.Response.ItemList.t()} | {:error, OpenAi.Error.error()}

Returns a list of input items for a given response.

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: The order to return the input items in. Default is asc.

    • asc: Return the input items in ascending order.
    • desc: Return the input items in descending order.
  • after: An item ID to list items after, used in pagination.

  • before: An item ID to list items before, used in pagination.

  • include: Additional fields to include in the response. See the include parameter for Response creation above for more information.