Projects
The /projects
endpoint allows you to manage your Projects.
Retrieve a Project
Endpoint: /projects/<PROJECT_ID>
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Data Type | Description |
---|---|---|
PROJECT_ID | string | The ID of the Project to retrieve. |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
{
"id": "<PROJECT_ID>",
"name": "My Project",
"namespace": "my-project",
"description": "This is my project.",
"account": "<ACCOUNT_ID>",
"configuration": {
"human_context": "You are a helpful AI assistant.",
"default_environment": "<ENVIRONMENT_ID>",
"default_model": "gpt-3.5-turbo",
"embeddings": {
"text": {
"environment": "<ENVIRONMENT_ID>",
"enabled": true,
"dimensions": 1536
}
}
},
"integrations": {},
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-07-19T13:54:12.854Z",
"updated_at": "2023-07-19T13:54:12.854Z"
}
Code Examples
Retrieve a Project
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
List Projects
Endpoint: /projects
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Query Parameters
Parameter | Data Type | Description |
---|---|---|
account | string[] | An optional list of Account IDs to filter by. |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
[
{
"id": "<PROJECT_ID>",
"name": "My Project",
"account": "<ACCOUNT_ID>"
}
]
Code Examples
List all Projects
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
List Projects for an Account
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects?account=<ACCOUNT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Create a Project
Endpoint: /projects
Method: POST
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
name | string | The name of the Project. |
namespace | string | The namespace of the Project. |
description | string | The description of the Project. |
Example Request
curl --location --request POST 'https://studio-server-production.api.becomposable.com/api/v1/projects' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Project",
"namespace": "my-project",
"description": "This is my project."
}'
Example Response
{
"id": "<PROJECT_ID>",
"name": "My Project",
"namespace": "my-project",
"description": "This is my project.",
"account": "<ACCOUNT_ID>",
"configuration": {
"human_context": "You are a helpful AI assistant.",
"embeddings": {}
},
"integrations": {},
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-07-19T13:54:12.854Z",
"updated_at": "2023-07-19T13:54:12.854Z"
}
Code Examples
Create a Project
curl --location --request POST 'https://studio-server-production.api.becomposable.com/api/v1/projects' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Project",
"namespace": "my-project",
"description": "This is my project."
}'
Update a Project
Endpoint: /projects/<PROJECT_ID>
Method: PUT
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Data Type | Description |
---|---|---|
PROJECT_ID | string | The ID of the Project to update. |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
name | string | The name of the Project. |
description | string | The description of the Project. |
configuration | ProjectConfiguration | The configuration of the Project. |
Example Request
curl --location --request PUT 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Updated Project",
"description": "This is my updated project.",
"configuration": {
"human_context": "You are a helpful AI assistant.",
"default_environment": "<ENVIRONMENT_ID>",
"default_model": "gpt-3.5-turbo"
}
}'
Example Response
{
"id": "<PROJECT_ID>",
"name": "My Updated Project",
"namespace": "my-project",
"description": "This is my updated project.",
"account": "<ACCOUNT_ID>",
"configuration": {
"human_context": "You are a helpful AI assistant.",
"default_environment": "<ENVIRONMENT_ID>",
"default_model": "gpt-3.5-turbo",
"embeddings": {}
},
"integrations": {},
"created_by": "user:<USER_ID>",
"updated_by": "user:<USER_ID>",
"created_at": "2023-07-19T13:54:12.854Z",
"updated_at": "2023-07-19T14:12:34.567Z"
}
Code Examples
Update a Project
curl --location --request PUT 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Updated Project",
"description": "This is my updated project.",
"configuration": {
"human_context": "You are a helpful AI assistant.",
"default_environment": "<ENVIRONMENT_ID>",
"default_model": "gpt-3.5-turbo"
}
}'
List Project Integrations
Endpoint: /projects/<PROJECT_ID>/integrations
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Data Type | Description |
---|---|---|
PROJECT_ID | string | The ID of the Project to retrieve Integrations for. |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
{
"integrations": [
{
"id": "gladia",
"enabled": false
},
{
"id": "github",
"enabled": false
}
]
}
Code Examples
List Project Integrations
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Retrieve a Project Integration Configuration
Endpoint: /projects/<PROJECT_ID>/integrations/<INTEGRATION_ID>
Method: GET
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Data Type | Description |
---|---|---|
PROJECT_ID | string | The ID of the Project to retrieve the Integration Configuration for. |
INTEGRATION_ID | string | The ID of the Integration to retrieve. |
Example Request
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations/gladia' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Example Response
{
"enabled": false,
"api_key": "sk-...",
"url": "https://gladia.com"
}
Code Examples
Retrieve a Project Integration Configuration
curl --location --request GET 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations/gladia' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Update a Project Integration Configuration
Endpoint: /projects/<PROJECT_ID>/integrations/<INTEGRATION_ID>
Method: PUT
Headers
Header | Value |
---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> |
Path Parameters
Parameter | Data Type | Description |
---|---|---|
PROJECT_ID | string | The ID of the Project to update the Integration Configuration for. |
INTEGRATION_ID | string | The ID of the Integration to update. |
Input Parameters
Parameter | Data Type | Description |
---|---|---|
enabled | boolean | Whether the Integration is enabled. |
api_key | string | The API Key for the Integration. |
url | string | The URL for the Integration. |
allowed_repositories | string[] | The list of allowed repositories for the Integration. |
Example Request
curl --location --request PUT 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations/gladia' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"enabled": true,
"api_key": "sk-...",
"url": "https://gladia.com"
}'
Example Response
{
"enabled": true,
"api_key": "sk-...",
"url": "https://gladia.com"
}
Code Examples
Update a Project Integration Configuration
curl --location --request PUT 'https://studio-server-production.api.becomposable.com/api/v1/projects/<PROJECT_ID>/integrations/gladia' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"enabled": true,
"api_key": "sk-...",
"url": "https://gladia.com"
}'
Workflow DSL
The Composable Platform uses a DSL to define workflows. The DSL is a JSON object that describes the steps of the workflow. Each step can be either an activity or a child workflow.
Activities
The following activities are available:
Activity Name | Description | Parameters | Output |
---|---|---|---|
extractText | Extracts text from a document. | document : The document to extract text from. | text : The extracted text. |
generateText | Generates text using a prompt template. | prompt : The prompt template to use. data : The data to pass to the prompt template. | text : The generated text. |
translateText | Translates text from one language to another. | text : The text to translate. targetLanguage : The target language. | translatedText : The translated text. |
summarizeText | Summarizes text. | text : The text to summarize. | summary : The summarized text. |
analyzeSentiment | Analyzes the sentiment of text. | text : The text to analyze. | sentiment : The sentiment of the text. |
classifyText | Classifies text into categories. | text : The text to classify. categories : The categories to classify into. | category : The category of the text. |
extractEntities | Extracts entities from text. | text : The text to extract entities from. | entities : The extracted entities. |
generateEmbeddings | Generates embeddings for text. | text : The text to generate embeddings for. | embeddings : The generated embeddings. |
searchEmbeddings | Searches for similar text using embeddings. | embeddings : The embeddings to search for. | results : The search results. |
createDocument | Creates a new document. | type : The type of the document. properties : The properties of the document. | document : The created document. |
updateDocument | Updates an existing document. | document : The document to update. properties : The properties to update. | document : The updated document. |
deleteDocument | Deletes an existing document. | document : The document to delete. | |
executeInteraction | Executes an existing interaction. | interaction : The interaction to execute. data : The data to pass to the interaction. | result : The result of the interaction. |
runJavascriptCode | Runs JavaScript code. | code : The JavaScript code to run. | result : The result of the code execution. |
sleep | Pauses the workflow for a specified amount of time. | duration : The duration to pause for. | |
log | Logs a message to the console. | message : The message to log. |
Child Workflows
Child workflows are used to execute another workflow as a step in the current workflow. The name
property specifies the endpoint of the child workflow to execute. The async
property specifies whether or not to wait for the child workflow to finish before continuing the current workflow.
Example DSL Workflow
{
"name": "My Workflow",
"description": "This is my workflow.",
"vars": {
"myVariable": "Hello World!"
},
"steps": [
{
"type": "activity",
"name": "log",
"params": {
"message": "The value of myVariable is: ${myVariable}"
}
},
{
"type": "workflow",
"name": "My Child Workflow",
"async": true,
"output": "childWorkflowResult"
}
]
}
DSL Variables
The DSL supports variables that can be used to store data and pass it between steps. Variables are defined in the vars
property of the workflow. The value of a variable can be a literal value or a reference to another variable. References to variables are enclosed in ${}
. For example, the following DSL defines a variable named myVariable
with the value "Hello World!":
{
"vars": {
"myVariable": "Hello World!"
}
}
The value of myVariable
can then be referenced in other parts of the DSL using ${myVariable}
. For example, the following DSL logs the value of myVariable
to the console:
{
"steps": [
{
"type": "activity",
"name": "log",
"params": {
"message": "The value of myVariable is: ${myVariable}"
}
}
]
}
DSL Conditions
The DSL supports conditions that can be used to control the flow of the workflow. Conditions are defined in the condition
property of a step. The value of a condition is a JSON object that describes the condition. The following operators are supported:
Operator | Description |
---|---|
$eq | Equal to |
$ne | Not equal to |
$gt | Greater than |
$gte | Greater than or equal to |
$lt | Less than |
$lte | Less than or equal to |
$in | In array |
$nin | Not in array |
$regexp | Matches regular expression |
For example, the following DSL defines a step that only executes if the value of the variable myVariable
is equal to "Hello World!":
{
"steps": [
{
"type": "activity",
"name": "log",
"condition": {
"$eq": {
"myVariable": "Hello World!"
}
},
"params": {
"message": "The value of myVariable is: ${myVariable}"
}
}
]
}
DSL Fetch
The DSL supports fetching data from external sources during the workflow execution. The fetch
property of a step is used to define the data to fetch. The value of the fetch
property is a JSON object that describes the data to fetch. The following properties are supported:
Property | Description |
---|---|
type | The type of data to fetch. |
source | The source of the data. |
query | The query to use to fetch the data. |
select | The fields to select from the fetched data. |
limit | The maximum number of results to fetch. |
on_not_found | How to handle not found objects. |
For example, the following DSL defines a step that fetches a document from the store:
{
"steps": [
{
"type": "activity",
"name": "fetchDocument",
"fetch": {
"type": "document",
"query": {
"id": "${documentId}"
}
},
"output": "document"
}
]
}
DSL Projection
The DSL supports projecting data from the result of an activity. The projection
property of a step is used to define the data to project. The value of the projection
property is a JSON object that describes the data to project. The following operators are supported:
Operator | Description |
---|---|
$include | Include the specified fields. |
$exclude | Exclude the specified fields. |
For example, the following DSL defines a step that projects the name
and description
fields from the result of the fetchDocument
activity:
{
"steps": [
{
"type": "activity",
"name": "fetchDocument",
"fetch": {
"type": "document",
"query": {
"id": "${documentId}"
}
},
"output": "document"
},
{
"type": "activity",
"name": "projectDocument",
"params": {
"document": "${document}"
},
"projection": {
"$include": [
"name",
"description"
]
},
"output": "projectedDocument"
}
]
}