client.prompts.log({ ...params }) -> Humanloop.CreatePromptLogResponse
-
-
-
Log to a Prompt.
You can use query parameters
version_id, orenvironment, to target an existing version of the Prompt. Otherwise, the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Prompt details in the request body. In this case, we will check if the details correspond to an existing version of the Prompt. If they do not, we will create a new version. This is helpful in the case where you are storing or deriving your Prompt details in code.
-
-
-
await client.prompts.log({ path: "persona", prompt: { model: "gpt-4", template: [ { role: "system", content: "You are {{person}}. Answer questions as this person. Do not break character.", }, ], }, messages: [ { role: "user", content: "What really happened at Roswell?", }, ], inputs: { person: "Trump", }, createdAt: "2024-07-19T00:29:35.178992", error: undefined, providerLatency: 6.5931549072265625, outputMessage: { content: "Well, you know, there is so much secrecy involved in government, folks, it's unbelievable. They don't want to tell you everything. They don't tell me everything! But about Roswell, it's a very popular question. I know, I just know, that something very, very peculiar happened there. Was it a weather balloon? Maybe. Was it something extraterrestrial? Could be. I'd love to go down and open up all the classified documents, believe me, I would. But they don't let that happen. The Deep State, folks, the Deep State. They're unbelievable. They want to keep everything a secret. But whatever the truth is, I can tell you this: it's something big, very very big. Tremendous, in fact.", role: "assistant", }, promptTokens: 100, outputTokens: 220, promptCost: 0.00001, outputCost: 0.0002, finishReason: "stop", });
-
-
-
request:
Humanloop.PromptLogRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.updateLog(id, logId, { ...params }) -> Humanloop.LogResponse
-
-
-
Update a Log.
Update the details of a Log with the given ID.
-
-
-
await client.prompts.updateLog("id", "log_id");
-
-
-
id:
string— Unique identifier for Prompt.
-
logId:
string— Unique identifier for the Log.
-
request:
Humanloop.PromptLogUpdateRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.callStream({ ...params }) -> core.Stream
-
-
-
Call a Prompt.
Calling a Prompt calls the model provider before logging the request, responses and metadata to Humanloop.
You can use query parameters
version_id, orenvironment, to target an existing version of the Prompt. Otherwise the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Prompt details in the request body. In this case, we will check if the details correspond to an existing version of the Prompt. If they do not, we will create a new version. This is helpful in the case where you are storing or deriving your Prompt details in code.
-
-
-
const response = await client.prompts.callStream({}); for await (const item of response) { console.log(item); }
-
-
-
request:
Humanloop.PromptsCallStreamRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.call({ ...params }) -> Humanloop.PromptCallResponse
-
-
-
Call a Prompt.
Calling a Prompt calls the model provider before logging the request, responses and metadata to Humanloop.
You can use query parameters
version_id, orenvironment, to target an existing version of the Prompt. Otherwise the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Prompt details in the request body. In this case, we will check if the details correspond to an existing version of the Prompt. If they do not, we will create a new version. This is helpful in the case where you are storing or deriving your Prompt details in code.
-
-
-
await client.prompts.call({ path: "persona", prompt: { model: "gpt-4", template: [ { role: "system", content: "You are stockbot. Return latest prices.", }, ], tools: [ { name: "get_stock_price", description: "Get current stock price", parameters: { type: "object", properties: { ticker_symbol: { type: "string", name: "Ticker Symbol", description: "Ticker symbol of the stock", }, }, required: [], }, }, ], }, messages: [ { role: "user", content: "latest apple", }, ], });
-
-
-
request:
Humanloop.PromptsCallRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.list({ ...params }) -> core.Page
-
-
-
Get a list of all Prompts.
-
-
-
const response = await client.prompts.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.prompts.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListPromptsGetRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.upsert({ ...params }) -> Humanloop.PromptResponse
-
-
-
Create a Prompt or update it with a new version if it already exists.
Prompts are identified by the
IDor theirpath. The parameters (i.e. the prompt template, temperature, model etc.) determine the versions of the Prompt.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within a Prompt - attempting to create a version with a name that already exists will result in a 409 Conflict error.
-
-
-
await client.prompts.upsert({ path: "Personal Projects/Coding Assistant", model: "gpt-4o", endpoint: "chat", template: [ { content: "You are a helpful coding assistant specialising in {{language}}", role: "system", }, ], provider: "openai", maxTokens: -1, temperature: 0.7, versionName: "coding-assistant-v1", versionDescription: "Initial version", });
-
-
-
request:
Humanloop.PromptRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.get(id, { ...params }) -> Humanloop.PromptResponse
-
-
-
Retrieve the Prompt with the given ID.
By default, the deployed version of the Prompt is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Prompt.
-
-
-
await client.prompts.get("pr_30gco7dx6JDq4200GVOHa");
-
-
-
id:
string— Unique identifier for Prompt.
-
request:
Humanloop.GetPromptsIdGetRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.delete(id) -> void
-
-
-
Delete the Prompt with the given ID.
-
-
-
await client.prompts.delete("pr_30gco7dx6JDq4200GVOHa");
-
-
-
id:
string— Unique identifier for Prompt.
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.move(id, { ...params }) -> Humanloop.PromptResponse
-
-
-
Move the Prompt to a different path or change the name.
-
-
-
await client.prompts.move("pr_30gco7dx6JDq4200GVOHa", { path: "new directory/new name", });
-
-
-
id:
string— Unique identifier for Prompt.
-
request:
Humanloop.UpdatePromptRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.populate(id, { ...params }) -> Humanloop.PopulateTemplateResponse
-
-
-
Retrieve the Prompt with the given ID, including the populated template.
By default, the deployed version of the Prompt is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Prompt.
-
-
-
await client.prompts.populate("id", { body: { key: "value", }, });
-
-
-
id:
string— Unique identifier for Prompt.
-
request:
Humanloop.PopulatePromptsIdPopulatePostRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.listVersions(id, { ...params }) -> Humanloop.ListPrompts
-
-
-
Get a list of all the versions of a Prompt.
-
-
-
await client.prompts.listVersions("pr_30gco7dx6JDq4200GVOHa");
-
-
-
id:
string— Unique identifier for Prompt.
-
request:
Humanloop.ListVersionsPromptsIdVersionsGetRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.deletePromptVersion(id, versionId) -> void
-
-
-
Delete a version of the Prompt.
-
-
-
await client.prompts.deletePromptVersion("id", "version_id");
-
-
-
id:
string— Unique identifier for Prompt.
-
versionId:
string— Unique identifier for the specific version of the Prompt.
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.patchPromptVersion(id, versionId, { ...params }) -> Humanloop.PromptResponse
-
-
-
Update the name or description of the Prompt version.
-
-
-
await client.prompts.patchPromptVersion("id", "version_id", {});
-
-
-
id:
string— Unique identifier for Prompt.
-
versionId:
string— Unique identifier for the specific version of the Prompt.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.setDeployment(id, environmentId, { ...params }) -> Humanloop.PromptResponse
-
-
-
Deploy Prompt to an Environment.
Set the deployed version for the specified Environment. This Prompt will be used for calls made to the Prompt in this Environment.
-
-
-
await client.prompts.setDeployment("id", "environment_id", { versionId: "version_id", });
-
-
-
id:
string— Unique identifier for Prompt.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentPromptsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Prompt from the Environment.
Remove the deployed version for the specified Environment. This Prompt will no longer be used for calls made to the Prompt in this Environment.
-
-
-
await client.prompts.removeDeployment("id", "environment_id");
-
-
-
id:
string— Unique identifier for Prompt.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Prompt.
-
-
-
await client.prompts.listEnvironments("pr_30gco7dx6JDq4200GVOHa");
-
-
-
id:
string— Unique identifier for Prompt.
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.updateMonitoring(id, { ...params }) -> Humanloop.PromptResponse
-
-
-
Activate and deactivate Evaluators for monitoring the Prompt.
An activated Evaluator will automatically be run on all new Logs within the Prompt for monitoring purposes.
-
-
-
await client.prompts.updateMonitoring("pr_30gco7dx6JDq4200GVOHa", { activate: [ { evaluatorVersionId: "evv_1abc4308abd", }, ], });
-
-
-
id:
string
-
request:
Humanloop.EvaluatorActivationDeactivationRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.serialize(id, { ...params }) -> string
-
-
-
Serialize a Prompt to the .prompt file format.
Useful for storing the Prompt with your code in a version control system, or for editing with an AI tool.
By default, the deployed version of the Prompt is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Prompt.
-
-
-
await client.prompts.serialize("id");
-
-
-
id:
string— Unique identifier for Prompt.
-
request:
Humanloop.SerializePromptsIdSerializeGetRequest
-
requestOptions:
Prompts.RequestOptions
-
-
client.prompts.deserialize({ ...params }) -> Humanloop.PromptKernelRequest
-
-
-
Deserialize a Prompt from the .prompt file format.
This returns a subset of the attributes required by a Prompt. This subset is the bit that defines the Prompt version (e.g. with
modelandtemperatureetc)
-
-
-
await client.prompts.deserialize({ prompt: "prompt", });
-
-
-
request:
Humanloop.BodyDeserializePromptsDeserializePost
-
requestOptions:
Prompts.RequestOptions
-
-
client.tools.call({ ...params }) -> Humanloop.ToolCallResponse
-
-
-
Call a Tool.
Calling a Tool with inputs runs the tool's source code and logs the result and metadata to Humanloop.
You can use query parameters
version_id, orenvironment, to target an existing version of the Tool. Otherwise, the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Tool details in the request body. In this case, we will check if the details correspond to an existing version of the Tool. If they do not, we will create a new version. This is helpful in the case where you are storing or deriving your Tool details in code.
-
-
-
await client.tools.call();
-
-
-
request:
Humanloop.ToolCallRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.log({ ...params }) -> Humanloop.CreateToolLogResponse
-
-
-
Log to a Tool.
You can use query parameters
version_id, orenvironment, to target an existing version of the Tool. Otherwise the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Tool details in the request body. In this case, we will check if the details correspond to an existing version of the Tool, if not we will create a new version. This is helpful in the case where you are storing or deriving your Tool details in code.
-
-
-
await client.tools.log({ path: "math-tool", tool: { function: { name: "multiply", description: "Multiply two numbers", parameters: { type: "object", properties: { a: { type: "number", }, b: { type: "number", }, }, required: ["a", "b"], }, }, }, inputs: { a: 5, b: 7, }, output: "35", });
-
-
-
request:
Humanloop.ToolLogRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.update(id, logId, { ...params }) -> Humanloop.LogResponse
-
-
-
Update a Log.
Update the details of a Log with the given ID.
-
-
-
await client.tools.update("id", "log_id");
-
-
-
id:
string— Unique identifier for Prompt.
-
logId:
string— Unique identifier for the Log.
-
request:
Humanloop.ToolLogUpdateRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.list({ ...params }) -> core.Page
-
-
-
Get a list of all Tools.
-
-
-
const response = await client.tools.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.tools.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListToolsGetRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.upsert({ ...params }) -> Humanloop.ToolResponse
-
-
-
Create a Tool or update it with a new version if it already exists.
Tools are identified by the
IDor theirpath. The name, description and parameters determine the versions of the Tool.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within a Tool - attempting to create a version with a name that already exists will result in a 409 Conflict error.
-
-
-
await client.tools.upsert({ path: "math-tool", function: { name: "multiply", description: "Multiply two numbers", parameters: { type: "object", properties: { a: { type: "number", }, b: { type: "number", }, }, required: ["a", "b"], }, }, versionName: "math-tool-v1", versionDescription: "Simple math tool that multiplies two numbers", });
-
-
-
request:
Humanloop.ToolRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.get(id, { ...params }) -> Humanloop.ToolResponse
-
-
-
Retrieve the Tool with the given ID.
By default, the deployed version of the Tool is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Tool.
-
-
-
await client.tools.get("tl_789ghi");
-
-
-
id:
string— Unique identifier for Tool.
-
request:
Humanloop.GetToolsIdGetRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.delete(id) -> void
-
-
-
Delete the Tool with the given ID.
-
-
-
await client.tools.delete("tl_789ghi");
-
-
-
id:
string— Unique identifier for Tool.
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.move(id, { ...params }) -> Humanloop.ToolResponse
-
-
-
Move the Tool to a different path or change the name.
-
-
-
await client.tools.move("tl_789ghi", { path: "new directory/new name", });
-
-
-
id:
string— Unique identifier for Tool.
-
request:
Humanloop.UpdateToolRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.listVersions(id, { ...params }) -> Humanloop.ListTools
-
-
-
Get a list of all the versions of a Tool.
-
-
-
await client.tools.listVersions("tl_789ghi");
-
-
-
id:
string— Unique identifier for the Tool.
-
request:
Humanloop.ListVersionsToolsIdVersionsGetRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.deleteToolVersion(id, versionId) -> void
-
-
-
Delete a version of the Tool.
-
-
-
await client.tools.deleteToolVersion("id", "version_id");
-
-
-
id:
string— Unique identifier for Tool.
-
versionId:
string— Unique identifier for the specific version of the Tool.
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.updateToolVersion(id, versionId, { ...params }) -> Humanloop.ToolResponse
-
-
-
Update the name or description of the Tool version.
-
-
-
await client.tools.updateToolVersion("id", "version_id", {});
-
-
-
id:
string— Unique identifier for Tool.
-
versionId:
string— Unique identifier for the specific version of the Tool.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.setDeployment(id, environmentId, { ...params }) -> Humanloop.ToolResponse
-
-
-
Deploy Tool to an Environment.
Set the deployed version for the specified Environment. This Prompt will be used for calls made to the Tool in this Environment.
-
-
-
await client.tools.setDeployment("tl_789ghi", "staging", { versionId: "tv_012jkl", });
-
-
-
id:
string— Unique identifier for Tool.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentToolsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Tool from the Environment.
Remove the deployed version for the specified Environment. This Tool will no longer be used for calls made to the Tool in this Environment.
-
-
-
await client.tools.removeDeployment("tl_789ghi", "staging");
-
-
-
id:
string— Unique identifier for Tool.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Tool.
-
-
-
await client.tools.listEnvironments("tl_789ghi");
-
-
-
id:
string— Unique identifier for Tool.
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.updateMonitoring(id, { ...params }) -> Humanloop.ToolResponse
-
-
-
Activate and deactivate Evaluators for monitoring the Tool.
An activated Evaluator will automatically be run on all new Logs within the Tool for monitoring purposes.
-
-
-
await client.tools.updateMonitoring("tl_789ghi", { activate: [ { evaluatorVersionId: "evv_1abc4308abd", }, ], });
-
-
-
id:
string
-
request:
Humanloop.EvaluatorActivationDeactivationRequest
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.getEnvironmentVariables(id) -> Humanloop.FileEnvironmentVariableRequest[]
-
-
-
await client.tools.getEnvironmentVariables("id");
-
-
-
id:
string— Unique identifier for File.
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.addEnvironmentVariable(id, { ...params }) -> Humanloop.FileEnvironmentVariableRequest[]
-
-
-
Add an environment variable to a Tool.
-
-
-
await client.tools.addEnvironmentVariable("id", [ { name: "name", value: "value", }, ]);
-
-
-
id:
string— Unique identifier for Tool.
-
request:
Humanloop.FileEnvironmentVariableRequest[]
-
requestOptions:
Tools.RequestOptions
-
-
client.tools.deleteEnvironmentVariable(id, name) -> Humanloop.FileEnvironmentVariableRequest[]
-
-
-
await client.tools.deleteEnvironmentVariable("id", "name");
-
-
-
id:
string— Unique identifier for File.
-
name:
string— Name of the Environment Variable to delete.
-
requestOptions:
Tools.RequestOptions
-
-
client.datasets.list({ ...params }) -> core.Page
-
-
-
List all Datasets.
-
-
-
const response = await client.datasets.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.datasets.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListDatasetsGetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.upsert({ ...params }) -> Humanloop.DatasetResponse
-
-
-
Create a Dataset or update it with a new version if it already exists.
Datasets are identified by the
IDor theirpath. The datapoints determine the versions of the Dataset.By default, the new Dataset version will be set to the list of Datapoints provided in the request. You can also create a new version by adding or removing Datapoints from an existing version by specifying
actionasaddorremoverespectively. In this case, you may specify theversion_idorenvironmentquery parameters to identify the existing version to base the new version on. If neither is provided, the latest created version will be used.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within a Dataset - attempting to create a version with a name that already exists will result in a 409 Conflict error.Humanloop also deduplicates Datapoints. If you try to add a Datapoint that already exists, it will be ignored. If you intentionally want to add a duplicate Datapoint, you can add a unique identifier to the Datapoint's inputs such as
{_dedupe_id: <unique ID>}.
-
-
-
await client.datasets.upsert({ path: "test-questions", datapoints: [ { inputs: { question: "What is the capital of France?", }, target: { answer: "Paris", }, }, { inputs: { question: "Who wrote Hamlet?", }, target: { answer: "William Shakespeare", }, }, ], action: "set", versionName: "test-questions-v1", versionDescription: "Add two new questions and answers", });
-
-
-
request:
Humanloop.DatasetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.get(id, { ...params }) -> Humanloop.DatasetResponse
-
-
-
Retrieve the Dataset with the given ID.
Unless
include_datapointsis set totrue, the response will not include the Datapoints. Use the List Datapoints endpoint (GET /{id}/datapoints) to efficiently retrieve Datapoints for a large Dataset.By default, the deployed version of the Dataset is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Dataset.
-
-
-
await client.datasets.get("ds_b0baF1ca7652", { versionId: "dsv_6L78pqrdFi2xa", includeDatapoints: true, });
-
-
-
id:
string— Unique identifier for Dataset.
-
request:
Humanloop.GetDatasetsIdGetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.delete(id) -> void
-
-
-
Delete the Dataset with the given ID.
-
-
-
await client.datasets.delete("id");
-
-
-
id:
string— Unique identifier for Dataset.
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.move(id, { ...params }) -> Humanloop.DatasetResponse
-
-
-
Move the Dataset to a different path or change the name.
-
-
-
await client.datasets.move("id");
-
-
-
id:
string— Unique identifier for Dataset.
-
request:
Humanloop.UpdateDatasetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.listDatapoints(id, { ...params }) -> core.Page
-
-
-
List all Datapoints for the Dataset with the given ID.
-
-
-
const response = await client.datasets.listDatapoints("ds_b0baF1ca7652", { size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.datasets.listDatapoints("ds_b0baF1ca7652", { size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
id:
string— Unique identifier for Dataset.
-
request:
Humanloop.ListDatapointsDatasetsIdDatapointsGetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.listVersions(id, { ...params }) -> Humanloop.ListDatasets
-
-
-
Get a list of the versions for a Dataset.
-
-
-
await client.datasets.listVersions("ds_b0baF1ca7652");
-
-
-
id:
string— Unique identifier for Dataset.
-
request:
Humanloop.ListVersionsDatasetsIdVersionsGetRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.deleteDatasetVersion(id, versionId) -> void
-
-
-
Delete a version of the Dataset.
-
-
-
await client.datasets.deleteDatasetVersion("id", "version_id");
-
-
-
id:
string— Unique identifier for Dataset.
-
versionId:
string— Unique identifier for the specific version of the Dataset.
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.updateDatasetVersion(id, versionId, { ...params }) -> Humanloop.DatasetResponse
-
-
-
Update the name or description of the Dataset version.
-
-
-
await client.datasets.updateDatasetVersion("id", "version_id", {});
-
-
-
id:
string— Unique identifier for Dataset.
-
versionId:
string— Unique identifier for the specific version of the Dataset.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.uploadCsv(file, id, { ...params }) -> Humanloop.DatasetResponse
-
-
-
Add Datapoints from a CSV file to a Dataset.
This will create a new version of the Dataset with the Datapoints from the CSV file.
If either
version_idorenvironmentis provided, the new version will be based on the specified version, with the Datapoints from the CSV file added to the existing Datapoints in the version. If neitherversion_idnorenvironmentis provided, the new version will be based on the version of the Dataset that is deployed to the default Environment.You can optionally provide a name and description for the new version using
version_nameandversion_descriptionparameters.
-
-
-
await client.datasets.uploadCsv(fs.createReadStream("/path/to/your/file"), "id", {});
-
-
-
file:
File | fs.ReadStream | Blob
-
id:
string
-
request:
Humanloop.BodyUploadCsvDatasetsIdDatapointsCsvPost
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.setDeployment(id, environmentId, { ...params }) -> Humanloop.DatasetResponse
-
-
-
Deploy Dataset to Environment.
Set the deployed version for the specified Environment.
-
-
-
await client.datasets.setDeployment("ds_b0baF1ca7652", "staging", { versionId: "dsv_6L78pqrdFi2xa", });
-
-
-
id:
string— Unique identifier for Dataset.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentDatasetsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Dataset from Environment.
Remove the deployed version for the specified Environment.
-
-
-
await client.datasets.removeDeployment("ds_b0baF1ca7652", "staging");
-
-
-
id:
string— Unique identifier for Dataset.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Dataset.
-
-
-
await client.datasets.listEnvironments("id");
-
-
-
id:
string— Unique identifier for Dataset.
-
requestOptions:
Datasets.RequestOptions
-
-
client.evaluators.log({ ...params }) -> Humanloop.CreateEvaluatorLogResponse
-
-
-
Submit Evaluator judgment for an existing Log.
Creates a new Log. The evaluated Log will be set as the parent of the created Log.
-
-
-
await client.evaluators.log({ parentId: "parent_id", });
-
-
-
request:
Humanloop.CreateEvaluatorLogRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.list({ ...params }) -> core.Page
-
-
-
Get a list of all Evaluators.
-
-
-
const response = await client.evaluators.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.evaluators.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListEvaluatorsGetRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.upsert({ ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Create an Evaluator or update it with a new version if it already exists.
Evaluators are identified by the
IDor theirpath. The spec provided determines the version of the Evaluator.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within an Evaluator - attempting to create a version with a name that already exists will result in a 409 Conflict error.
-
-
-
await client.evaluators.upsert({ path: "Shared Evaluators/Accuracy Evaluator", spec: { argumentsType: "target_required", returnType: "number", evaluatorType: "python", code: "def evaluate(answer, target):\n return 0.5", }, versionName: "simple-evaluator", versionDescription: "Simple evaluator that returns 0.5", });
-
-
-
request:
Humanloop.EvaluatorRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.get(id, { ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Retrieve the Evaluator with the given ID.
By default, the deployed version of the Evaluator is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Evaluator.
-
-
-
await client.evaluators.get("ev_890bcd");
-
-
-
id:
string— Unique identifier for Evaluator.
-
request:
Humanloop.GetEvaluatorsIdGetRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.delete(id) -> void
-
-
-
Delete the Evaluator with the given ID.
-
-
-
await client.evaluators.delete("ev_890bcd");
-
-
-
id:
string— Unique identifier for Evaluator.
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.move(id, { ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Move the Evaluator to a different path or change the name.
-
-
-
await client.evaluators.move("ev_890bcd", { path: "new directory/new name", });
-
-
-
id:
string— Unique identifier for Evaluator.
-
request:
Humanloop.UpdateEvaluatorRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.listVersions(id, { ...params }) -> Humanloop.ListEvaluators
-
-
-
Get a list of all the versions of an Evaluator.
-
-
-
await client.evaluators.listVersions("ev_890bcd");
-
-
-
id:
string— Unique identifier for the Evaluator.
-
request:
Humanloop.ListVersionsEvaluatorsIdVersionsGetRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.deleteEvaluatorVersion(id, versionId) -> void
-
-
-
Delete a version of the Evaluator.
-
-
-
await client.evaluators.deleteEvaluatorVersion("id", "version_id");
-
-
-
id:
string— Unique identifier for Evaluator.
-
versionId:
string— Unique identifier for the specific version of the Evaluator.
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.updateEvaluatorVersion(id, versionId, { ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Update the name or description of the Evaluator version.
-
-
-
await client.evaluators.updateEvaluatorVersion("id", "version_id", {});
-
-
-
id:
string— Unique identifier for Evaluator.
-
versionId:
string— Unique identifier for the specific version of the Evaluator.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.setDeployment(id, environmentId, { ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Deploy Evaluator to an Environment.
Set the deployed version for the specified Environment. This Evaluator will be used for calls made to the Evaluator in this Environment.
-
-
-
await client.evaluators.setDeployment("ev_890bcd", "staging", { versionId: "evv_012def", });
-
-
-
id:
string— Unique identifier for Evaluator.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentEvaluatorsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Evaluator from the Environment.
Remove the deployed version for the specified Environment. This Evaluator will no longer be used for calls made to the Evaluator in this Environment.
-
-
-
await client.evaluators.removeDeployment("ev_890bcd", "staging");
-
-
-
id:
string— Unique identifier for Evaluator.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Evaluator.
-
-
-
await client.evaluators.listEnvironments("ev_890bcd");
-
-
-
id:
string— Unique identifier for Evaluator.
-
requestOptions:
Evaluators.RequestOptions
-
-
client.evaluators.updateMonitoring(id, { ...params }) -> Humanloop.EvaluatorResponse
-
-
-
Activate and deactivate Evaluators for monitoring the Evaluator.
An activated Evaluator will automatically be run on all new Logs within the Evaluator for monitoring purposes.
-
-
-
await client.evaluators.updateMonitoring("id", {});
-
-
-
id:
string
-
request:
Humanloop.EvaluatorActivationDeactivationRequest
-
requestOptions:
Evaluators.RequestOptions
-
-
client.flows.log({ ...params }) -> Humanloop.CreateFlowLogResponse
-
-
-
Log to a Flow.
You can use query parameters
version_id, orenvironment, to target an existing version of the Flow. Otherwise, the default deployed version will be chosen.
-
-
-
await client.flows.log({ id: "fl_6o701g4jmcanPVHxdqD0O", flow: { attributes: { prompt: { template: "You are a helpful assistant helping with medical anamnesis", model: "gpt-4o", temperature: 0.8, }, tool: { name: "retrieval_tool_v3", description: "Retrieval tool for MedQA.", source_code: "def retrieval_tool(question: str) -> str:\n pass\n", }, }, }, inputs: { question: "Patient with a history of diabetes and hypertension presents with chest pain and shortness of breath.", }, output: "The patient is likely experiencing a myocardial infarction. Immediate medical attention is required.", logStatus: "incomplete", startTime: "2024-07-08T22:40:35", endTime: "2024-07-08T22:40:39", });
-
-
-
request:
Humanloop.FlowLogRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.updateLog(logId, { ...params }) -> Humanloop.FlowLogResponse
-
-
-
Update the status, inputs, output of a Flow Log.
Marking a Flow Log as complete will trigger any monitoring Evaluators to run. Inputs and output (or error) must be provided in order to mark it as complete.
The end_time log attribute will be set to match the time the log is marked as complete.
-
-
-
await client.flows.updateLog("medqa_experiment_0001", { inputs: { question: "Patient with a history of diabetes and normal tension presents with chest pain and shortness of breath.", }, output: "The patient is likely experiencing a myocardial infarction. Immediate medical attention is required.", logStatus: "complete", error: undefined, });
-
-
-
logId:
string— Unique identifier of the Flow Log.
-
request:
Humanloop.UpdateFlowLogRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.get(id, { ...params }) -> Humanloop.FlowResponse
-
-
-
Retrieve the Flow with the given ID.
By default, the deployed version of the Flow is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Flow.
-
-
-
await client.flows.get("fl_6o701g4jmcanPVHxdqD0O");
-
-
-
id:
string— Unique identifier for Flow.
-
request:
Humanloop.GetFlowsIdGetRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.delete(id) -> void
-
-
-
Delete the Flow with the given ID.
-
-
-
await client.flows.delete("fl_6o701g4jmcanPVHxdqD0O");
-
-
-
id:
string— Unique identifier for Flow.
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.move(id, { ...params }) -> Humanloop.FlowResponse
-
-
-
Move the Flow to a different path or change the name.
-
-
-
await client.flows.move("fl_6o701g4jmcanPVHxdqD0O", { path: "new directory/new name", });
-
-
-
id:
string— Unique identifier for Flow.
-
request:
Humanloop.UpdateFlowRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.list({ ...params }) -> core.Page
-
-
-
Get a list of Flows.
-
-
-
const response = await client.flows.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.flows.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListFlowsGetRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.upsert({ ...params }) -> Humanloop.FlowResponse
-
-
-
Create or update a Flow.
Flows can also be identified by the
IDor theirpath.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within a Flow - attempting to create a version with a name that already exists will result in a 409 Conflict error.
-
-
-
await client.flows.upsert({ path: "Personal Projects/MedQA Flow", attributes: { prompt: { template: "You are a helpful medical assistant helping with medical anamnesis. Answer {{question}}", model: "gpt-4o", temperature: 0.8, }, tool: { name: "retrieval_tool_v3", description: "Retrieval tool for MedQA.", source_code: "def retrieval_tool(question: str) -> str:\n pass\n", }, version_name: "medqa-flow-v1", version_description: "Initial version", }, });
-
-
-
request:
Humanloop.FlowRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.listVersions(id, { ...params }) -> Humanloop.ListFlows
-
-
-
Get a list of all the versions of a Flow.
-
-
-
await client.flows.listVersions("fl_6o701g4jmcanPVHxdqD0O");
-
-
-
id:
string— Unique identifier for Flow.
-
request:
Humanloop.ListVersionsFlowsIdVersionsGetRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.deleteFlowVersion(id, versionId) -> void
-
-
-
Delete a version of the Flow.
-
-
-
await client.flows.deleteFlowVersion("id", "version_id");
-
-
-
id:
string— Unique identifier for Flow.
-
versionId:
string— Unique identifier for the specific version of the Flow.
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.updateFlowVersion(id, versionId, { ...params }) -> Humanloop.FlowResponse
-
-
-
Update the name or description of the Flow version.
-
-
-
await client.flows.updateFlowVersion("id", "version_id", {});
-
-
-
id:
string— Unique identifier for Flow.
-
versionId:
string— Unique identifier for the specific version of the Flow.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.setDeployment(id, environmentId, { ...params }) -> Humanloop.FlowResponse
-
-
-
Deploy Flow to an Environment.
Set the deployed version for the specified Environment. This Flow will be used for calls made to the Flow in this Environment.
-
-
-
await client.flows.setDeployment("fl_6o701g4jmcanPVHxdqD0O", "staging", { versionId: "flv_6o701g4jmcanPVHxdqD0O", });
-
-
-
id:
string— Unique identifier for Flow.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentFlowsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Flow from the Environment.
Remove the deployed version for the specified Environment. This Flow will no longer be used for calls made to the Flow in this Environment.
-
-
-
await client.flows.removeDeployment("fl_6o701g4jmcanPVHxdqD0O", "staging");
-
-
-
id:
string— Unique identifier for Flow.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Flow.
-
-
-
await client.flows.listEnvironments("fl_6o701g4jmcanPVHxdqD0O");
-
-
-
id:
string— Unique identifier for Flow.
-
requestOptions:
Flows.RequestOptions
-
-
client.flows.updateMonitoring(id, { ...params }) -> Humanloop.FlowResponse
-
-
-
Activate and deactivate Evaluators for monitoring the Flow.
An activated Evaluator will automatically be run on all new "completed" Logs within the Flow for monitoring purposes.
-
-
-
await client.flows.updateMonitoring("fl_6o701g4jmcanPVHxdqD0O", { activate: [ { evaluatorVersionId: "evv_1abc4308abd", }, ], });
-
-
-
id:
string
-
request:
Humanloop.EvaluatorActivationDeactivationRequest
-
requestOptions:
Flows.RequestOptions
-
-
client.agents.log({ ...params }) -> Humanloop.CreateAgentLogResponse
-
-
-
Create an Agent Log.
You can use query parameters
version_id, orenvironment, to target an existing version of the Agent. Otherwise, the default deployed version will be chosen.If you create the Agent Log with a
log_statusofincomplete, you should later update it tocompletein order to trigger Evaluators.
-
-
-
await client.agents.log({ path: "Banking/Teller Agent", agent: { provider: "anthropic", endpoint: "chat", model: "claude-3-7-sonnet-latest", reasoningEffort: 1024, template: [ { role: "system", content: "You are a helpful digital assistant, helping users navigate our digital banking platform.", }, ], maxIterations: 3, tools: [ { type: "file", link: { fileId: "pr_1234567890", versionId: "prv_1234567890", }, onAgentCall: "continue", }, { type: "inline", jsonSchema: { name: "stop", description: "Call this tool when you have finished your task.", parameters: { type: "object", properties: { output: { type: "string", description: "The final output to return to the user.", }, }, additionalProperties: false, required: ["output"], }, strict: true, }, onAgentCall: "stop", }, ], }, });
-
-
-
request:
Humanloop.AgentLogRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.updateLog(id, logId, { ...params }) -> Humanloop.AgentLogResponse
-
-
-
Update a Log.
Update the details of a Log with the given ID.
-
-
-
await client.agents.updateLog("ag_1234567890", "log_1234567890", { messages: [ { role: "user", content: "I need to withdraw $1000", }, { role: "assistant", content: "Of course! Would you like to use your savings or checking account?", }, ], outputMessage: { role: "assistant", content: "I'm sorry, I can't help with that.", }, logStatus: "complete", });
-
-
-
id:
string— Unique identifier for Agent.
-
logId:
string— Unique identifier for the Log.
-
request:
Humanloop.UpdateAgentLogRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.callStream({ ...params }) -> core.Stream
-
-
-
Call an Agent. The Agent will run on the Humanloop runtime and return a completed Agent Log.
If the Agent requires a tool call that cannot be ran by Humanloop, execution will halt. To continue, pass the ID of the incomplete Log and the required tool call to the /agents/continue endpoint.
The agent will run for the maximum number of iterations, or until it encounters a stop condition, according to its configuration.
You can use query parameters
version_id, orenvironment, to target an existing version of the Agent. Otherwise the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Agent details in the request body. A new version is created if it does not match any existing ones. This is helpful in the case where you are storing or deriving your Agent details in code.
-
-
-
const response = await client.agents.callStream({}); for await (const item of response) { console.log(item); }
-
-
-
request:
Humanloop.AgentsCallStreamRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.call({ ...params }) -> Humanloop.AgentCallResponse
-
-
-
Call an Agent. The Agent will run on the Humanloop runtime and return a completed Agent Log.
If the Agent requires a tool call that cannot be ran by Humanloop, execution will halt. To continue, pass the ID of the incomplete Log and the required tool call to the /agents/continue endpoint.
The agent will run for the maximum number of iterations, or until it encounters a stop condition, according to its configuration.
You can use query parameters
version_id, orenvironment, to target an existing version of the Agent. Otherwise the default deployed version will be chosen.Instead of targeting an existing version explicitly, you can instead pass in Agent details in the request body. A new version is created if it does not match any existing ones. This is helpful in the case where you are storing or deriving your Agent details in code.
-
-
-
await client.agents.call({ path: "Banking/Teller Agent", messages: [ { role: "user", content: "I'd like to deposit $1000 to my savings account from my checking account.", }, ], });
-
-
-
request:
Humanloop.AgentsCallRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.continueCallStream({ ...params }) -> core.Stream
-
-
-
Continue an incomplete Agent call.
This endpoint allows continuing an existing incomplete Agent call, by passing the tool call requested by the Agent. The Agent will resume processing from where it left off.
The messages in the request will be appended to the original messages in the Log. You do not have to provide the previous conversation history.
The original log must be in an incomplete state to be continued.
-
-
-
const response = await client.agents.continueCallStream({ logId: "log_id", messages: [ { role: "user", }, ], }); for await (const item of response) { console.log(item); }
-
-
-
request:
Humanloop.AgentsContinueCallStreamRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.continueCall({ ...params }) -> Humanloop.AgentContinueCallResponse
-
-
-
Continue an incomplete Agent call.
This endpoint allows continuing an existing incomplete Agent call, by passing the tool call requested by the Agent. The Agent will resume processing from where it left off.
The messages in the request will be appended to the original messages in the Log. You do not have to provide the previous conversation history.
The original log must be in an incomplete state to be continued.
-
-
-
await client.agents.continueCall({ logId: "log_1234567890", messages: [ { role: "tool", content: '{"type": "checking", "balance": 5200}', toolCallId: "tc_1234567890", }, ], });
-
-
-
request:
Humanloop.AgentsContinueCallRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.list({ ...params }) -> core.Page
-
-
-
Get a list of all Agents.
-
-
-
const response = await client.agents.list({ size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.agents.list({ size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListAgentsGetRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.upsert({ ...params }) -> Humanloop.AgentResponse
-
-
-
Create an Agent or update it with a new version if it already exists.
Agents are identified by the
IDor theirpath. The parameters (i.e. the template, temperature, model etc.) and tools determine the versions of the Agent.You can provide
version_nameandversion_descriptionto identify and describe your versions. Version names must be unique within an Agent - attempting to create a version with a name that already exists will result in a 409 Conflict error.
-
-
-
await client.agents.upsert({ path: "Banking/Teller Agent", provider: "anthropic", endpoint: "chat", model: "claude-3-7-sonnet-latest", reasoningEffort: 1024, template: [ { role: "system", content: "You are a helpful digital assistant, helping users navigate our digital banking platform.", }, ], maxIterations: 3, tools: [ { type: "inline", jsonSchema: { name: "stop", description: "Call this tool when you have finished your task.", parameters: { type: "object", properties: { output: { type: "string", description: "The final output to return to the user.", }, }, additionalProperties: false, required: ["output"], }, strict: true, }, onAgentCall: "stop", }, ], versionName: "teller-agent-v1", versionDescription: "Initial version", });
-
-
-
request:
Humanloop.AgentRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.deleteAgentVersion(id, versionId) -> void
-
-
-
Delete a version of the Agent.
-
-
-
await client.agents.deleteAgentVersion("ag_1234567890", "agv_1234567890");
-
-
-
id:
string— Unique identifier for Agent.
-
versionId:
string— Unique identifier for the specific version of the Agent.
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.patchAgentVersion(id, versionId, { ...params }) -> Humanloop.AgentResponse
-
-
-
Update the name or description of the Agent version.
-
-
-
await client.agents.patchAgentVersion("ag_1234567890", "agv_1234567890", { name: "teller-agent-v2", description: "Updated version", });
-
-
-
id:
string— Unique identifier for Agent.
-
versionId:
string— Unique identifier for the specific version of the Agent.
-
request:
Humanloop.UpdateVersionRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.get(id, { ...params }) -> Humanloop.AgentResponse
-
-
-
Retrieve the Agent with the given ID.
By default, the deployed version of the Agent is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Agent.
-
-
-
await client.agents.get("ag_1234567890");
-
-
-
id:
string— Unique identifier for Agent.
-
request:
Humanloop.GetAgentsIdGetRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.delete(id) -> void
-
-
-
Delete the Agent with the given ID.
-
-
-
await client.agents.delete("ag_1234567890");
-
-
-
id:
string— Unique identifier for Agent.
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.move(id, { ...params }) -> Humanloop.AgentResponse
-
-
-
Move the Agent to a different path or change the name.
-
-
-
await client.agents.move("ag_1234567890", { path: "new directory/new name", });
-
-
-
id:
string— Unique identifier for Agent.
-
request:
Humanloop.UpdateAgentRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.listVersions(id, { ...params }) -> Humanloop.ListAgents
-
-
-
Get a list of all the versions of a Agent.
-
-
-
await client.agents.listVersions("ag_1234567890");
-
-
-
id:
string— Unique identifier for Agent.
-
request:
Humanloop.ListVersionsAgentsIdVersionsGetRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.setDeployment(id, environmentId, { ...params }) -> Humanloop.AgentResponse
-
-
-
Deploy Agent to an Environment.
Set the deployed version for the specified Environment. This Agent will be used for calls made to the Agent in this Environment.
-
-
-
await client.agents.setDeployment("id", "environment_id", { versionId: "version_id", });
-
-
-
id:
string— Unique identifier for Agent.
-
environmentId:
string— Unique identifier for the Environment to deploy the Version to.
-
request:
Humanloop.SetDeploymentAgentsIdEnvironmentsEnvironmentIdPostRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.removeDeployment(id, environmentId) -> void
-
-
-
Remove deployed Agent from the Environment.
Remove the deployed version for the specified Environment. This Agent will no longer be used for calls made to the Agent in this Environment.
-
-
-
await client.agents.removeDeployment("id", "environment_id");
-
-
-
id:
string— Unique identifier for Agent.
-
environmentId:
string— Unique identifier for the Environment to remove the deployment from.
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[]
-
-
-
List all Environments and their deployed versions for the Agent.
-
-
-
await client.agents.listEnvironments("ag_1234567890");
-
-
-
id:
string— Unique identifier for Agent.
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.updateMonitoring(id, { ...params }) -> Humanloop.AgentResponse
-
-
-
Activate and deactivate Evaluators for monitoring the Agent.
An activated Evaluator will automatically be run on all new Logs within the Agent for monitoring purposes.
-
-
-
await client.agents.updateMonitoring("ag_1234567890", { activate: [ { evaluatorVersionId: "ev_1234567890", }, { evaluatorId: "ev_2345678901", environmentId: "env_1234567890", }, ], deactivate: [ { evaluatorVersionId: "ev_0987654321", }, ], });
-
-
-
id:
string
-
request:
Humanloop.EvaluatorActivationDeactivationRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.serialize(id, { ...params }) -> string
-
-
-
Serialize an Agent to the .agent file format.
Useful for storing the Agent with your code in a version control system, or for editing with an AI tool.
By default, the deployed version of the Agent is returned. Use the query parameters
version_idorenvironmentto target a specific version of the Agent.
-
-
-
await client.agents.serialize("id");
-
-
-
id:
string— Unique identifier for Agent.
-
request:
Humanloop.SerializeAgentsIdSerializeGetRequest
-
requestOptions:
Agents.RequestOptions
-
-
client.agents.deserialize({ ...params }) -> Humanloop.AgentKernelRequest
-
-
-
Deserialize an Agent from the .agent file format.
This returns a subset of the attributes required by an Agent. This subset is the bit that defines the Agent version (e.g. with
modelandtemperatureetc)
-
-
-
await client.agents.deserialize({ agent: "agent", });
-
-
-
request:
Humanloop.BodyDeserializeAgentsDeserializePost
-
requestOptions:
Agents.RequestOptions
-
-
client.directories.list() -> Humanloop.DirectoryResponse[]
-
-
-
Retrieve a list of all Directories.
-
-
-
await client.directories.list();
-
-
-
requestOptions:
Directories.RequestOptions
-
-
client.directories.create({ ...params }) -> Humanloop.DirectoryResponse
-
-
-
Creates a Directory.
-
-
-
await client.directories.create();
-
-
-
request:
Humanloop.CreateDirectoryRequest
-
requestOptions:
Directories.RequestOptions
-
-
client.directories.get(id) -> Humanloop.DirectoryWithParentsAndChildrenResponse
-
-
-
Fetches a directory by ID.
-
-
-
await client.directories.get("id");
-
-
-
id:
string— String ID of directory. Starts withdir_.
-
requestOptions:
Directories.RequestOptions
-
-
client.directories.delete(id) -> void
-
-
-
Delete the Directory with the given ID.
The Directory must be empty (i.e. contain no Directories or Files).
-
-
-
await client.directories.delete("id");
-
-
-
id:
string— Unique identifier for Directory. Starts withdir_.
-
requestOptions:
Directories.RequestOptions
-
-
client.directories.update(id, { ...params }) -> Humanloop.DirectoryResponse
-
-
-
Update the Directory with the given ID.
-
-
-
await client.directories.update("id");
-
-
-
id:
string— Unique identifier for Directory. Starts withdir_.
-
request:
Humanloop.UpdateDirectoryRequest
-
requestOptions:
Directories.RequestOptions
-
-
client.files.listFiles({ ...params }) -> Humanloop.PaginatedDataUnionPromptResponseToolResponseDatasetResponseEvaluatorResponseFlowResponseAgentResponse
-
-
-
Get a paginated list of files.
-
-
-
await client.files.listFiles();
-
-
-
request:
Humanloop.ListFilesFilesGetRequest
-
requestOptions:
Files.RequestOptions
-
-
client.files.retrieveByPath({ ...params }) -> Humanloop.RetrieveByPathFilesRetrieveByPathPostResponse
-
-
-
Retrieve a File by path.
-
-
-
await client.files.retrieveByPath({ path: "path", });
-
-
-
request:
Humanloop.BodyRetrieveByPathFilesRetrieveByPathPost
-
requestOptions:
Files.RequestOptions
-
-
client.evaluations.list({ ...params }) -> core.Page
-
-
-
Retrieve a list of Evaluations for the specified File.
-
-
-
const response = await client.evaluations.list({ fileId: "pr_30gco7dx6JDq4200GVOHa", size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.evaluations.list({ fileId: "pr_30gco7dx6JDq4200GVOHa", size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListEvaluationsGetRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.create({ ...params }) -> Humanloop.EvaluationResponse
-
-
-
Create an Evaluation.
Create a new Evaluation by specifying the File to evaluate, and a name for the Evaluation. You can then add Runs to this Evaluation using the
POST /evaluations/{id}/runsendpoint.
-
-
-
await client.evaluations.create({ evaluators: [ { versionId: "version_id", }, ], });
-
-
-
request:
Humanloop.CreateEvaluationRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.addEvaluators(id, { ...params }) -> Humanloop.EvaluationResponse
-
-
-
Add Evaluators to an Evaluation.
The Evaluators will be run on the Logs generated for the Evaluation.
-
-
-
await client.evaluations.addEvaluators("id", { evaluators: [ { versionId: "version_id", }, ], });
-
-
-
id:
string— Unique identifier for Evaluation.
-
request:
Humanloop.AddEvaluatorsRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.removeEvaluator(id, evaluatorVersionId) -> Humanloop.EvaluationResponse
-
-
-
Remove an Evaluator from an Evaluation.
The Evaluator will no longer be run on the Logs in the Evaluation.
-
-
-
await client.evaluations.removeEvaluator("id", "evaluator_version_id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
evaluatorVersionId:
string— Unique identifier for Evaluator Version.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.get(id) -> Humanloop.EvaluationResponse
-
-
-
Get an Evaluation.
This includes the Evaluators associated with the Evaluation and metadata about the Evaluation, such as its name.
To get the Runs associated with the Evaluation, use the
GET /evaluations/{id}/runsendpoint. To retrieve stats for the Evaluation, use theGET /evaluations/{id}/statsendpoint.
-
-
-
await client.evaluations.get("ev_567yza");
-
-
-
id:
string— Unique identifier for Evaluation.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.delete(id) -> void
-
-
-
Delete an Evaluation.
The Runs and Evaluators in the Evaluation will not be deleted.
-
-
-
await client.evaluations.delete("ev_567yza");
-
-
-
id:
string— Unique identifier for Evaluation.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.listRunsForEvaluation(id) -> Humanloop.EvaluationRunsResponse
-
-
-
List all Runs for an Evaluation.
-
-
-
await client.evaluations.listRunsForEvaluation("id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.createRun(id, { ...params }) -> Humanloop.EvaluationRunResponse
-
-
-
Create an Evaluation Run.
Optionally specify the Dataset and version to be evaluated.
Humanloop will automatically start generating Logs and running Evaluators where
orchestrated=true. If you are generating Logs yourself, you can setorchestrated=falseand then generate and submit the required Logs via the API.If
datasetandversionare provided, you can setuse_existing_logs=Trueto reuse existing Logs, avoiding generating new Logs unnecessarily. Logs that are associated with the specified Version and havesource_datapoint_idreferencing a datapoint in the specified Dataset will be associated with the Run.To keep updated on the progress of the Run, you can poll the Run using the
GET /evaluations/{id}/runsendpoint and check its status.
-
-
-
await client.evaluations.createRun("id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
request:
Humanloop.CreateRunRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.addExistingRun(id, runId) -> unknown
-
-
-
Add an existing Run to the specified Evaluation.
This is useful if you want to compare the Runs in this Evaluation with an existing Run that exists within another Evaluation.
-
-
-
await client.evaluations.addExistingRun("id", "run_id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
runId:
string— Unique identifier for Run.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.removeRun(id, runId) -> void
-
-
-
Remove a Run from an Evaluation.
The Logs and Versions used in the Run will not be deleted. If this Run is used in any other Evaluations, it will still be available in those Evaluations.
-
-
-
await client.evaluations.removeRun("id", "run_id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
runId:
string— Unique identifier for Run.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.updateEvaluationRun(id, runId, { ...params }) -> Humanloop.EvaluationRunResponse
-
-
-
Update an Evaluation Run.
Specify
control=trueto use this Run as the control Run for the Evaluation. You can cancel a running/pending Run, or mark a Run that uses external or human Evaluators as completed.
-
-
-
await client.evaluations.updateEvaluationRun("id", "run_id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
runId:
string— Unique identifier for Run.
-
request:
Humanloop.UpdateEvaluationRunRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.addLogsToRun(id, runId, { ...params }) -> Humanloop.EvaluationRunResponse
-
-
-
Add the specified Logs to a Run.
-
-
-
await client.evaluations.addLogsToRun("id", "run_id", { logIds: ["log_ids"], });
-
-
-
id:
string— Unique identifier for Evaluation.
-
runId:
string— Unique identifier for Run.
-
request:
Humanloop.AddLogsToRunRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.getStats(id) -> Humanloop.EvaluationStats
-
-
-
Get Evaluation Stats.
Retrieve aggregate stats for the specified Evaluation. This includes the number of generated Logs for each Run and the corresponding Evaluator statistics (such as the mean and percentiles).
-
-
-
await client.evaluations.getStats("id");
-
-
-
id:
string— Unique identifier for Evaluation.
-
requestOptions:
Evaluations.RequestOptions
-
-
client.evaluations.getLogs(id, { ...params }) -> Humanloop.PaginatedDataEvaluationLogResponse
-
-
-
Get the Logs associated to a specific Evaluation.
This returns the Logs associated to all Runs within with the Evaluation.
-
-
-
await client.evaluations.getLogs("id");
-
-
-
id:
string— String ID of evaluation. Starts withev_orevr_.
-
request:
Humanloop.GetLogsEvaluationsIdLogsGetRequest
-
requestOptions:
Evaluations.RequestOptions
-
-
client.logs.list({ ...params }) -> core.Page
-
-
-
List all Logs for the given filter criteria.
-
-
-
const response = await client.logs.list({ fileId: "file_123abc", size: 1, }); for await (const item of response) { console.log(item); } // Or you can manually iterate page-by-page const page = await client.logs.list({ fileId: "file_123abc", size: 1, }); while (page.hasNextPage()) { page = page.getNextPage(); }
-
-
-
request:
Humanloop.ListLogsGetRequest
-
requestOptions:
Logs.RequestOptions
-
-
client.logs.delete({ ...params }) -> void
-
-
-
Delete Logs with the given IDs.
-
-
-
await client.logs.delete({ id: "prv_Wu6zx1lAWJRqOyL8nWuZk", });
-
-
-
request:
Humanloop.LogsDeleteRequest
-
requestOptions:
Logs.RequestOptions
-
-
client.logs.get(id) -> Humanloop.LogResponse
-
-
-
Retrieve the Log with the given ID.
-
-
-
await client.logs.get("prv_Wu6zx1lAWJRqOyL8nWuZk");
-
-
-
id:
string— Unique identifier for Log.
-
requestOptions:
Logs.RequestOptions
-
-