Comment on page

Making your first Callable

Callable is currently in private preview, only selected developers and customers have access to Callable Builder. If you'd like to submit a request please contact [email protected]!
Callable is the serverless function that powers each copilot, or any of your AI workflows. Let's build a Callable today that helps recommend movies to watch!

1. Create a knowledge

One of the powerful features of Cortex is to let AI interact with your own data. Knowledge is where you store your data.
Head to the knowledge tab here and create a knowledge
Cortex supports multiple upload options. Let's use Web as our options. Enter the Knowledge name and description and go to the the next step
Enter the url of Rotten Tomateo: Follow the rest of the set up and your knowledge should be ready to go!
Give the knowledge upload process a few minutes to fully sync up. You can continue to the next step, the sync up process will continue to run in the background.

2. Create Callable

Navigate to Callable Builder and create a callable. Enter the name, description, and set the visibility. We will use "Chat" callable template, which is configured to work with Chat copilot.
Go to the RETRIEVALS block, and select rotten-tomateo as your knowledge. You could select multiple knowledge if you have more information.
You are almost there! Now the last thing to edit would be the prompt that passed into the language model. Let's modify the prompt in the language model block called OUTPUT_STREAM to this:
You are an expert of movies. Please answer this following question: {{EXTRACT_QUESTION}}, base on following content:
Please answer the questions with the best of your knowledge. If not, please ask more questions for more information and recommend with some suggestions based on common knowledge.
You can make up an answer if you really cannot answer the question.
let's begin!
Let's also set the Max Tokens to around 2000.

3. Test your Callable

We've configured our Callable. But how do we know if it will work well? Let's create some test datasets. Go to the Datasets tab and go into ChatDataset.
You can write a few new test cases like this:
Now you are good to run tests! Go back to Design tab and click Run TestCases.
Results from each block will be displayed below each block. We can go to the final OUTPUT block to check if the final results look good.

4. Deploy!

When you feel confident about your Callable's results, hit Deploy on the right top corner. The API for running this callable will be instantly generated, and now can integrate this into your product!
Remember to always run TestCases before hitting Deploy. After editing your Callable, If you don't run TestCases, Deploy won't freeze your edits into the next version. If you see that the version number hasn't incremented after Deploy, that means there is no new changes being added in production. Try run TestCases and then Deploy.

5. Running it with a Copilot (optional)

You could directly consume the Callable API from your project, or you can connect a copilot to this callable and start chatting with it immediately.
Create a new Copilot and configure it as such to connect to the callable.
Congratulations! Now you should be able to directly chat with your movie recommendation assistant.