Chat Experiment

Get a chat response for a specific experiment.

Body Params

Base chat request.

string

Unique project name. If no project exists with this name, a new project will be created.

string

Unique ID of a project to associate to the log. Either this or project must be provided.

string

ID of the session to associate the datapoint.

string

A unique string identifying the session to associate the datapoint to. Allows you to log multiple datapoints to a session (using an ID kept by your internal systems) by passing the same session_reference_id in subsequent log requests. Specify at most one of this or session_id.

string

ID associated to the parent datapoint in a session.

string

A unique string identifying the previously-logged parent datapoint in a session. Allows you to log nested datapoints with your internal system IDs by passing the same reference ID as parent_id in a prior log request. Specify at most one of this or parent_id. Note that this cannot refer to a datapoint being logged in the same request.

inputs
object

The inputs passed to the prompt template.

string

Identifies where the model was called from.

metadata
object

Any additional metadata to record.

boolean
Defaults to true

Whether the request/response payloads will be stored on Humanloop.

string

ID of the source datapoint if this is a log derived from a datapoint in a dataset.

provider_api_keys
object

API keys required by each provider to make API calls. The API keys provided here are not stored by Humanloop. If not specified here, Humanloop will fall back to the key saved to your organization.

integer
Defaults to 1

The number of chat responses, where each chat response will use a model configuration sampled from the experiment.

boolean
Defaults to false

If true, tokens will be sent as data-only server-sent events. If num_samples > 1, samples are streamed back independently.

string

End-user ID passed through to provider call.

integer
deprecated

Deprecated field: the seed is instead set as part of the request.config object.

boolean
Defaults to true

Whether to return the inputs in the response. If false, the response will contain an empty dictionary under inputs. This is useful for reducing the size of the response. Defaults to true.

messages
array of objects
required

The messages passed to the to provider chat endpoint.

Messages*
string | ToolChoice

Controls how the model uses tools. The following options are supported: 'none' forces the model to not call a tool; the default when no tools are provided as part of the model config. 'auto' the model can decide to call one of the provided tools; the default when tools are provided as part of the model config. Providing {'type': 'function', 'function': {name': <TOOL_NAME>}} forces the model to use the named function.

string | object
deprecated

NB: Deprecated with new tool_choice. Controls how the model uses tools. The following options are supported: 'none' forces the model to not call a tool; the default when no tools are provided as part of the model config. 'auto' the model can decide to call one of the provided tools; the default when tools are provided as part of the model config. Providing {'name': <TOOL_NAME>} forces the model to use the provided tool of the same name.

response_format
object

Response format of the model.

string
required

If an experiment ID is provided a model configuration will be sampled from the experiments active model configurations.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json