api
object to make calls to the Literal service.
Promise
<string
>
the project id
Parameter | Type | Description |
---|---|---|
steps | Step [] | An array of Step objects to be sent. |
type | description |
---|---|
Promise <any > | The response from the GraphQL call |
Parameter | Type | Description |
---|---|---|
variables | object | The parameters to filter and paginate the steps. |
variables.first ? | Maybe <number > | The number of steps to retrieve after the cursor. (Optional) |
variables.after ? | Maybe <string > | The cursor to start retrieving steps after. (Optional) |
variables.before ? | Maybe <string > | The cursor to start retrieving steps before. (Optional) |
variables.filters ? | StepsFilter [] | The filters to apply on the steps retrieval. (Optional) |
variables.orderBy ? | StepsOrderBy | The order in which to retrieve the steps. (Optional) |
type | description |
---|---|
Promise <PaginatedResponse <Step >> | A promise that resolves to a paginated response of steps |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the step to retrieve. |
type | description |
---|---|
Promise <Maybe <Step >> | A Promise that resolves to the step if found, or null if not found |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the step to delete. |
type | description |
---|---|
Promise <string > | A Promise that resolves to the ID of the deleted step |
Parameter | Type | Description |
---|---|---|
params | UploadFileParamsWithContent | The parameters for uploading a file, including: |
type | description |
---|---|
Promise <object > | An object containing the objectKey of the uploaded file and the signed url , or null values if the upload fails |
content
nor path
is provided, or if the server response is invalid.
uploadFile(params)
Parameter | Type |
---|---|
params | UploadFileParamsWithPath |
Promise
<object
>
Parameter | Type | Description |
---|---|---|
params | UploadFileBaseParams & object & CreateAttachmentParams | The parameters for uploading a file, including: |
type | description |
---|---|
Promise <Attachment > | An object containing the objectKey of the uploaded file and the signed url , or null values if the upload fails |
content
nor path
is provided, or if the server response is invalid.
createAttachment(params)
Parameter | Type |
---|---|
params | UploadFileBaseParams & object & CreateAttachmentParams |
Promise
<Attachment
>
Parameter | Type | Description |
---|---|---|
variables | object | The variables to filter and sort the Generations. It includes: - first : The number of items to return.- after : The cursor to fetch items after.- before : The cursor to fetch items before.- filters : The filters applied to the Generations.- orderBy : The order in which the Generations are sorted. |
variables.first ? | Maybe <number > | - |
variables.after ? | Maybe <string > | - |
variables.before ? | Maybe <string > | - |
variables.filters ? | GenerationsFilter [] | - |
variables.orderBy ? | GenerationsOrderBy | - |
type | description |
---|---|
Promise <PaginatedResponse <PersistedGeneration >> | A Promise that resolves to a PaginatedResponse<Generation> object containing the filtered and sorted Generations |
Parameter | Type | Description |
---|---|---|
generation | Generation | The Generation object to be created and sent to the platform. |
type | description |
---|---|
Promise <PersistedGeneration > | A Promise resolving to the newly created Generation object |
Parameter | Type | Description |
---|---|---|
options | object | The parameters to upsert a thread. |
options.threadId | string | The unique identifier of the thread. (Required) |
options.name ? | Maybe <string > | The name of the thread. (Optional) |
options.metadata ? | Maybe <Record <string , any >> | Additional metadata for the thread as a key-value pair object. (Optional) |
options.participantId ? | Maybe <string > | The unique identifier of the participant. (Optional) |
options.tags ? | Maybe <string []> | An array of tags associated with the thread. (Optional) |
type | description |
---|---|
Promise <CleanThreadFields > | The upserted thread object |
Parameter | Type | Description |
---|---|---|
threadId | string | The unique identifier of the thread. (Required) |
name ? | Maybe <string > | The name of the thread. (Optional) |
metadata ? | Maybe <Record <string , any >> | Additional metadata for the thread as a key-value pair object. (Optional) |
participantId ? | Maybe <string > | The unique identifier of the participant. (Optional) |
tags ? | Maybe <string []> | An array of tags associated with the thread. (Optional) |
type | description |
---|---|
Promise <CleanThreadFields > | The upserted thread object |
Parameter | Type | Description |
---|---|---|
variables | object | The parameters to filter and paginate the threads. |
variables.first ? | Maybe <number > | The number of threads to retrieve after the cursor. (Optional) |
variables.after ? | Maybe <string > | The cursor to start retrieving threads after. (Optional) |
variables.before ? | Maybe <string > | The cursor to start retrieving threads before. (Optional) |
variables.filters ? | ThreadsFilter [] | The filters to apply on the threads retrieval. (Optional) |
variables.orderBy ? | ThreadsOrderBy | The order in which to retrieve the threads. (Optional) |
variables.stepTypesToKeep ? | StepType [] | - |
type | description |
---|---|
Promise <PaginatedResponse <Thread >> | A promise that resolves to a paginated response of threads |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the thread. This parameter is required. |
type | description |
---|---|
Promise <Maybe <Thread >> | The detailed information of the specified thread |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the thread to be deleted. This parameter is required. |
type | description |
---|---|
Promise <string > | The ID of the deleted thread |
Parameter | Type | Description |
---|---|---|
variables | object | The parameters used to filter and paginate the user list. |
variables.first ? | Maybe <number > | Optional. The number of items to return. |
variables.after ? | Maybe <string > | Optional. The cursor after which to start fetching data. |
variables.before ? | Maybe <string > | Optional. The cursor before which to start fetching data. |
variables.filters ? | ParticipantsFilter [] | Optional. Array of filters to apply to the user query. |
type | description |
---|---|
Promise <PaginatedResponse <OmitUtils <User >>> | A PaginatedResponse containing a list of users without utility types |
Parameter | Type | Description |
---|---|---|
identifier | string | The unique identifier for the user. This parameter is required. |
metadata ? | Maybe <Record <string , any >> | Optional metadata for the user. This parameter is optional. |
type | description |
---|---|
Promise <User > | A promise that resolves with the newly created User object |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the user to update. This parameter is required. |
identifier ? | string | A new identifier for the user. This parameter is optional. |
metadata ? | Maybe <Record <string , any >> | Additional metadata for the user. This parameter is optional. |
type | description |
---|---|
Promise <User > | A promise that resolves with the updated User object |
Parameter | Type | Description |
---|---|---|
identifier | string | The unique identifier for the user. This parameter is required. |
metadata ? | Maybe <Record <string , any >> | Additional metadata for the user. This parameter is optional. |
type | description |
---|---|
Promise <string > | The ID of the existing or newly created user |
Parameter | Type | Description |
---|---|---|
identifier | string | The unique identifier for the user. This parameter is required. |
type | description |
---|---|
Promise <Maybe <User >> | A Promise that resolves to a User object if found, otherwise undefined |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the user to be deleted. This parameter is required. |
type | description |
---|---|
Promise <string > | A Promise that resolves to the ID of the deleted user |
Parameter | Type | Description |
---|---|---|
variables | object | The parameters for querying scores. |
variables.first ? | Maybe <number > | Optional. The number of scores to retrieve. |
variables.after ? | Maybe <string > | Optional. The cursor after which to start fetching scores. |
variables.before ? | Maybe <string > | Optional. The cursor before which to start fetching scores. |
variables.filters ? | ScoresFilter [] | Optional. Filters to apply to the score query. |
variables.orderBy ? | ScoresOrderBy | Optional. The order in which to sort the scores. |
type | description |
---|---|
Promise <PaginatedResponse <OmitUtils <Score >>> | A Promise that resolves to a paginated response of scores, excluding certain utility fields |
Parameter | Type | Description |
---|---|---|
scores | Score [] | An array of Score objects to be created. |
type | description |
---|---|
Promise <Score []> | A promise that resolves to an array of Score instances populated with the created scores’ data |
Parameter | Type | Description |
---|---|---|
variables | OmitUtils <Score > | The score details to be used in the creation process. This includes: |
type | description |
---|---|
Promise <Score > | A new Score instance populated with the created score’s data |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the score to update. (required) |
updateParams | object | The parameters to update in the score. (required) |
updateParams.comment ? | Maybe <string > | A new or updated comment for the score. (optional) |
updateParams.value | number | The new value to set for the score. (required) |
type | description |
---|---|
Promise <Score > | A Score instance representing the updated score |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the score to delete. (required) |
type | description |
---|---|
Promise <any > | The ID of the deleted score |
type | description |
---|---|
Promise <object []> | The names and ids of all datasets |
Parameter | Type | Description |
---|---|---|
dataset | object | The dataset details to be created. |
dataset.name | string | The name of the dataset. (required) |
dataset.description ? | Maybe <string > | The description of the dataset. (optional) |
dataset.metadata ? | Maybe <Record <string , any >> | Additional metadata for the dataset as a key-value pair object. (optional) |
dataset.type ? | DatasetType | The type of the dataset, defined by the DatasetType enum. (optional) |
type | description |
---|---|
Promise <Dataset > | A new Dataset instance populated with the created dataset’s data |
Parameter | Type | Description |
---|---|---|
variables | object | An object containing optional id and name properties to specify which dataset to retrieve. |
variables.id ? | string | - |
variables.name ? | string | - |
type | description |
---|---|
Promise <null | Dataset > | A Dataset instance populated with the retrieved dataset’s data, or null if no data is found |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the dataset to update. This parameter is required. |
dataset | object | An object containing the new dataset information. |
dataset.name ? | Maybe <string > | The new name of the dataset. (optional) |
dataset.description ? | Maybe <string > | The new description of the dataset. (optional) |
dataset.metadata ? | Maybe <Record <string , any >> | Additional metadata for the dataset as a key-value pair object. (optional) |
type | description |
---|---|
Promise <Dataset > | A new Dataset instance populated with the updated dataset’s data |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the dataset to delete. This parameter is required. |
type | description |
---|---|
Promise <Dataset > | A new Dataset instance populated with the deleted dataset’s data |
Parameter | Type | Description |
---|---|---|
datasetId | string | The unique identifier of the dataset. This parameter is required. |
datasetItem | object | The data for the new dataset item. This parameter is required. |
datasetItem.input | Record <string , any > | The input data for the dataset item. This field is required. |
datasetItem.expectedOutput ? | Maybe <Record <string , any >> | The expected output data for the dataset item. This field is optional. |
datasetItem.metadata ? | Maybe <Record <string , any >> | Additional metadata for the dataset item. This field is optional. |
type | description |
---|---|
Promise <DatasetItem > | A new DatasetItem instance populated with the created dataset item’s data |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the dataset item. This parameter is required. |
type | description |
---|---|
Promise <DatasetItem > | A DatasetItem instance populated with the retrieved dataset item’s data |
Parameter | Type | Description |
---|---|---|
id | string | The unique identifier of the dataset item to be deleted. This parameter is required. |
type | description |
---|---|
Promise <DatasetItem > | A DatasetItem instance populated with the data of the deleted dataset item |
Parameter | Type | Description |
---|---|---|
datasetId | string | The unique identifier of the dataset. This parameter is required. |
stepId | string | The unique identifier of the step to be added. This parameter is required. |
metadata ? | Maybe <Record <string , unknown >> | Additional metadata for the step as a JSON object. This parameter is optional. |
type | description |
---|---|
Promise <DatasetItem > | A DatasetItem instance populated with the data of the newly added step |
Parameter | Type | Description |
---|---|---|
datasetId | string | The unique identifier of the dataset. This parameter is required. |
generationId | string | The unique identifier of the generation to be added. This parameter is required. |
metadata ? | Maybe <Record <string , unknown >> | Additional metadata for the generation as a JSON object. This parameter is optional. |
type | description |
---|---|
Promise <DatasetItem > | A DatasetItem instance populated with the data of the newly added generation |
Parameter | Type | Description |
---|---|---|
datasetId | string | The unique identifier of the dataset. This parameter is required. |
generationIds | string [] | An array of unique identifiers for the generations to be added. This parameter is required. |
Promise
<DatasetItem
[]>
An array of DatasetItem
instances populated with the data of the newly added generations
Parameter | Type | Description |
---|---|---|
datasetExperiment | object | |
datasetExperiment.name | string | The name of the dataset experiment. |
datasetExperiment.datasetId ? | string | The dataset ID to associate with the experiment. |
datasetExperiment.promptId ? | string | The prompt ID to associate with the experiment. |
datasetExperiment.params ? | Record <string , any > | Record <string , any >[] | The parameters for the experiment as a key-value pair object or an array of the same. |
type | description |
---|---|
Promise <DatasetExperiment > | The newly created dataset experiment object |
Parameter | Type | Description |
---|---|---|
parameters | DatasetExperimentItem |
type | description |
---|---|
Promise <DatasetExperimentItem > | The dataset experiment object |
Parameter | Type | Description |
---|---|---|
name | string | The name of the prompt lineage. This parameter is required. |
description ? | string | A description for the prompt lineage. This parameter is optional. |
type | description |
---|---|
Promise <any > | The newly created prompt lineage object, or null if creation failed |
Parameter | Type |
---|---|
name | string |
templateMessages | IGenerationMessage [] |
settings ? | Maybe <Record <string , any >> |
Promise
<Prompt
>
Deprecated
Please use getOrCreatePrompt instead.
Parameter | Type | Description |
---|---|---|
name | string | The name of the prompt to retrieve or create. |
templateMessages | IGenerationMessage [] | A list of template messages for the prompt. |
settings ? | Maybe <Record <string , any >> | Optional settings for the prompt. |
tools ? | Maybe <Record <string , any >> | Optional tools for the prompt. |
type | description |
---|---|
Promise <Prompt > | The prompt that was retrieved or created |
Parameter | Type | Description |
---|---|---|
id | string | ID of the prompt to retrieve. |
type | description |
---|---|
Promise <null | Prompt > | The prompt with given ID |
Parameter | Type | Description |
---|---|---|
name | string | The name of the prompt to retrieve. |
version ? | number | The version number of the prompt (optional). |
type | description |
---|---|
Promise <null | Prompt > | An instance of Prompt containing the prompt data, or null if not found |
Parameter | Type | Description |
---|---|---|
name | string | The name of the prompt to retrieve. |
type | description |
---|---|
Promise <null | IPromptRollout []> | A list of prompt rollout versions |
Parameter | Type | Description |
---|---|---|
name | string | The name of the prompt to retrieve. |
rollouts | IPromptRollout [] | A list of prompt rollout versions. |
type | description |
---|---|
Promise <any > | A list of prompt rollout versions |