Salesforce Codegen
CodeGen is a family of autoregressive language models for program synthesis. Mono models were trained on Python code and multi was trained on multiple programming languages such as C, C++, Go, Java, JS and Python. The best way to use CodeGen is to give it a prompt describing the code you would like it to generate - you can read more here.
We currently have the following Codegen models available below however if you would like any others contact support, and we can quickly add it for you. In order to deploy it you can use the identifier below:
- Codegen 350M-multi:
sf-codegen-350-multi
Once you’ve deployed a Codegen model, you can supply the endpoint with a prompt. Here’s an example of how to call the deployed endpoint:
Request Parameters
curl --location --request POST 'https://run.cerebrium.ai/sf-codegen-350-multi-webhook/predict' \
--header 'Authorization: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "Generate a python function that prints 'Hello world'",
"max_sequence_length": 200
}'
This is the Cerebrium API key used to authenticate your request. You can get it from your Cerebrium dashboard.
The prompt you would like Codegen to process.
The max sequence length that codegen can generate
{
"run_id": "<UUID_STRING>",
"run_time_ms": 251,
"message": "Successfully generated text",
"result": "def hello_world(self):\nprint \"Hello world\""
}
Response Parameters
A unique identifier for the run that you can use to associate prompts with webhook endpoints.
The amount of time in millisecond it took to run your function. This is what you will be billed for.
Whether of not the response was successful
The result generated from Codegen
curl --location --request POST 'https://run.cerebrium.ai/sf-codegen-350-multi-webhook/predict' \
--header 'Authorization: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "Generate a python function that prints 'Hello world'",
"max_sequence_length": 200
}'
{
"run_id": "<UUID_STRING>",
"run_time_ms": 251,
"message": "Successfully generated text",
"result": "def hello_world(self):\nprint \"Hello world\""
}