Create a thread and run it in one request. To get more details, visit https://platform.openai.com/docs/api-reference/runs/createThreadAndRun https://platform.openai.com/docs/assistants
runs_create_thread_and_run_request(
assistant_id,
thread,
model = NULL,
instructions = NULL,
tools = NULL,
metadata = NULL,
api_key = api_get_key()
)
content of the httr response object or SimpleError (conditions) enhanced with two additional fields: `status_code` (response$status_code) and `message_long` (built on response content)
string, the ID of the assistant to use to execute this run
NULL/list,
list(
# messages "array" (list of list(s))
messages = list(
list(
# string (required), the role of the entity that is creating
# the message. Currently only user is supported.
role =
# string (required), the content of the message.
content =
# character vector (optional), a list of File IDs that
# the message should use. There can be a maximum of 10
# files attached to a message. Useful for tools like retrieval
# and code_interpreter that can access and use files.
file_ids =
# named list (optional), 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.
metadata = list (
meta1 = "value1"
)
)
),
# named list (optional), 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.
metadata = list(
metaX = "value y"
)
)
NULL/string, the ID of the model (https://platform.openai.com/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
NULL/string, overrides the instructions (https://platform.openai.com/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis.
NULL/named list, override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. Example:
# code interpreter tool
list(
type = "code_interpreter"
)
# or retrieval tool
list(
type = "retrieval"
)
# or function tool
list(
type = "retrieval",
function = list(
# string (optional), a description of what the function does, used by the model to choose when and how to call
# the function.
description =
# string (required), the name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and
# dashes, with a maximum length of 64.
name =
# list (optional), the parameters the functions accepts. See the guide
# (https://platform.openai.com/docs/guides/text-generation/function-calling) for examples. Omitting parameters
# defines a function with an empty parameter list.
parameters = list (
)
)
)
NULL/list, 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.
string, OpenAI API key (see https://platform.openai.com/account/api-keys)