Using the Cline AI assistant with the Lambda Inference API#
Introduction#
The Lambda Inference API can be used with the Cline AI assistant and VS Code to help you more efficiently accomplish your software development tasks. Together, the combination of Cline and the Lambda Inference API can be used not only for code completions and explanations in a single file, but also to understand entire codebases, create and edit files, run commands in a terminal, and much more.
In this tutorial, you'll first install Cline and configure Cline to use the Lambda Inference API. Then, you'll instruct Cline to perform two tasks using the Lambda Inference API:
- Create a Python program for the Lambda Inference API.
- Create a README with instructions for using the program.
Prerequisites#
For this tutorial, you'll need to generate a Lambda Cloud API key Or, you can use an existing Lambda Cloud API key.
Note
You're billed for all usage of the Lambda Inference API.
See the Lambda Inference API page for current pricing information.
Install Cline in VS Code#
First, install Cline in VS Code:
-
Open VS Code.
-
Press Ctrl + P to open Quick Open. Then, enter:
-
Press Enter to install Cline.
Configure Cline to use the Lambda Inference API#
Next, configure Cline to use the Lambda Inference API:
-
In the Activity Bar, click the Cline icon.
-
Click the Settings (⚙) button.
-
For API Provider, choose OpenAI Compatible.
Enter the values below. Replace
<CLOUD-API-KEY>
with your Lambda Cloud API key.- Base URL:
https://api.lambdalabs.com/v1
- API Key:
<CLOUD-API-KEY>
- Model ID:
qwen25-coder-32b-instruct
Tip
You can use any of the models that the Lambda Inference API supports instead of
qwen25-coder-32b-instruct
. See Using the Lambda Inference API. - Base URL:
-
Click Done.
Instruct Cline to perform tasks#
Finally, instruct Cline to create a:
- Python program for the Lambda Inference API.
- README that explains how to use the program.
Note
Again, you're billed for all usage of the Lambda Inference API.
Warning
Always exercise caution when running code generated by Cline and other AI assistants.
-
In the Type your task here field, enter the following prompt.
In one file, create a Python program based on the following command. The program should prompt for the values of <API-KEY> and <MODEL>. curl -sS https://api.lambdalabs.com/v1/completions \ -H "Authorization: Bearer <API-KEY>" \ -H "Content-Type: application/json" \ -d '{ "model": "<MODEL>", "prompt": "Computers are", "temperature": 0 }' In another file, create a README that explains how to use the program.
-
Press Enter to run the task. Cline explains the specific steps it will take to complete the task, and then begins creating the requested Python program:
-
When prompted, save the Python file that Cline creates. Cline begins generating the requested README file.
-
When prompted, save the generated README file. Cline outputs a message confirming that your task has been completed.