Projects

The /projects endpoint allows you to manage your Projects.

Retrieve a Project

Endpoint: /projects/<PROJECT_ID>

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PROJECT_IDstringThe 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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Query Parameters

ParameterData TypeDescription
accountstring[]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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
namestringThe name of the Project.
namespacestringThe namespace of the Project.
descriptionstringThe 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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PROJECT_IDstringThe ID of the Project to update.

Input Parameters

ParameterData TypeDescription
namestringThe name of the Project.
descriptionstringThe description of the Project.
configurationProjectConfigurationThe 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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PROJECT_IDstringThe 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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PROJECT_IDstringThe ID of the Project to retrieve the Integration Configuration for.
INTEGRATION_IDstringThe 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

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PROJECT_IDstringThe ID of the Project to update the Integration Configuration for.
INTEGRATION_IDstringThe ID of the Integration to update.

Input Parameters

ParameterData TypeDescription
enabledbooleanWhether the Integration is enabled.
api_keystringThe API Key for the Integration.
urlstringThe URL for the Integration.
allowed_repositoriesstring[]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 NameDescriptionParametersOutput
extractTextExtracts text from a document.document: The document to extract text from.text: The extracted text.
generateTextGenerates text using a prompt template.prompt: The prompt template to use. data: The data to pass to the prompt template.text: The generated text.
translateTextTranslates text from one language to another.text: The text to translate. targetLanguage: The target language.translatedText: The translated text.
summarizeTextSummarizes text.text: The text to summarize.summary: The summarized text.
analyzeSentimentAnalyzes the sentiment of text.text: The text to analyze.sentiment: The sentiment of the text.
classifyTextClassifies text into categories.text: The text to classify. categories: The categories to classify into.category: The category of the text.
extractEntitiesExtracts entities from text.text: The text to extract entities from.entities: The extracted entities.
generateEmbeddingsGenerates embeddings for text.text: The text to generate embeddings for.embeddings: The generated embeddings.
searchEmbeddingsSearches for similar text using embeddings.embeddings: The embeddings to search for.results: The search results.
createDocumentCreates a new document.type: The type of the document. properties: The properties of the document.document: The created document.
updateDocumentUpdates an existing document.document: The document to update. properties: The properties to update.document: The updated document.
deleteDocumentDeletes an existing document.document: The document to delete.
executeInteractionExecutes an existing interaction.interaction: The interaction to execute. data: The data to pass to the interaction.result: The result of the interaction.
runJavascriptCodeRuns JavaScript code.code: The JavaScript code to run.result: The result of the code execution.
sleepPauses the workflow for a specified amount of time.duration: The duration to pause for.
logLogs 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:

OperatorDescription
$eqEqual to
$neNot equal to
$gtGreater than
$gteGreater than or equal to
$ltLess than
$lteLess than or equal to
$inIn array
$ninNot in array
$regexpMatches 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:

PropertyDescription
typeThe type of data to fetch.
sourceThe source of the data.
queryThe query to use to fetch the data.
selectThe fields to select from the fetched data.
limitThe maximum number of results to fetch.
on_not_foundHow 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:

OperatorDescription
$includeInclude the specified fields.
$excludeExclude 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"
    }
  ]
}

Was this page helpful?