Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions menu/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -956,18 +956,6 @@
{
"label": "Data privacy",
"slug": "data-privacy"
},
{
"label": "Adding AI to VS Code using Continue",
"slug": "adding-ai-to-vscode-using-continue"
},
{
"label": "Adding AI to IntelliJ IDEA using Continue",
"slug": "adding-ai-to-intellij-using-continue"
},
{
"label": "Integrating Generative APIs with popular AI tools",
"slug": "integrating-generative-apis-with-popular-tools"
}
],
"label": "Additional Content",
Expand Down
127 changes: 31 additions & 96 deletions pages/generative-apis/how-to/query-code-models.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
meta:
title: How to query code models with Scaleway's Generative APIs
description: Learn how to interact with powerful code models using Scaleway's Generative APIs service. Integrate with VS Code and IntelliJ for enhanced coding experience.
title: How to query code models
description: Learn how to interact with powerful language models specialized in code using Scaleway's Generative APIs service.
content:
h1: How to query code models with Scaleway's Generative APIs
paragraph: Scaleway's Generative APIs service allows users to interact with powerful code models hosted on the platform. These code models are specialized in understanding code, generating code, and fixing code. With Scaleway's Generative APIs, you can integrate these code models with popular IDEs like VS Code and IntelliJ.
tags: generative-apis ai-data language-models code-models chat-completions-api scaleway-continue vs-code intellij
h1: How to query code models
paragraph: Learn how to interact with powerful language models specialized in code using Scaleway's Generative APIs service.
tags: generative-apis ai-data language-models code-models chat-completions-api
dates:
validation: 2025-02-14
validation: 2024-12-09
posted: 2024-12-09
---

Expand All @@ -28,100 +28,35 @@ Code models are also ideal AI assistants when **added to IDEs** (integrated deve
- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/) for API authentication
- Python 3.7+ installed on your system
- An IDE such as Visual Studio Code or JetBrains

### Querying code models with Scaleway's Generative APIs

1. Set up the OpenAI Python SDK:
- Install the SDK by running:
```bash
pip install openai
```
- Configure the SDK with your API key and Scaleway's API base URL:
```python
from openai import OpenAI

client = OpenAI(
base_url="https://api.scaleway.ai/v1",
api_key="###SCW_SECRET_KEY###"
)
```
Replace `"###SCW_SECRET_KEY###"` with your actual API secret key.

2. Make an API request:
- To generate code or receive assistance, send a request to the chat completion endpoint:
```python
completion = client.chat.completions.create(
model="qwen2.5-coder-32b-instruct",
messages=[{"role": "user", "content": "Write a Python function to sort a list using quicksort."}],
temperature=0.7,
max_tokens=150
)

print(completion.choices[0].message.content)
```
This will generate a Python function implementing the quicksort algorithm.


## Integrating Continue in VS Code and JetBrains IntelliJ

[Continue](https://www.continue.dev/) is an open-source code assistant that connects AI models to your IDE. It is available for Visual Studio Code (VS Code) and JetBrains IntelliJ:

* [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue)
* [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue)

### Installation of Continue

#### For Visual Studio Code

1. Open VS Code and navigate to the **Extensions** view (`Ctrl+Shift+X`).
2. Type `Continue` in the search bar and click **Install**.
3. The **Continue** icon should appear on the sidebar.

#### For JetBrains IntelliJ

1. Open your JetBrains IDE and go to **Settings** (`Ctrl+Alt+S`).
2. Select **Plugins** and search for `Continue` in the marketplace.
3. Click **Install**. The `Continue` icon should appear on the toolbar.

### Configuration of Continue

1. Locate the configuration file. The `config.json` file is typically found at:
- `~/.continue/config.json` on Linux/macOS
- `%USERPROFILE%\.continue\config.json` on Windows

2. Configure Continue to use Scaleway's API:
- Add the following configuration:
```json
{
"models": [
{
"model": "qwen2.5-coder-32b-instruct",
"title": "Qwen2.5-coder",
"provider": "scaleway",
"apiKey": "###SCW_SECRET_KEY###"
}
]
}
```
<Message type="tip">
Read more about how to set up your `config.json` on the [official Continue documentation](https://docs.continue.dev/reference).
</Message>
3. Restart your IDE after you have modified and saved the configuration file.
4. Open the **Command Palette** in VS Code by pressing `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac) and type `Continue` to access the extension's features.
## Install Continue in your IDE

<Message type="tip">
Refer to our dedicated documentation for detailed information on how to integrate Continue in your favourite IDE.
- [Integrating Continue Dev with Visual Studio Code](/generative-apis/reference-content/adding-ai-to-vscode-using-continue/)
- [Integrating Continue Dev with IntelliJ IDEA](/generative-apis/reference-content/adding-ai-to-intellij-using-continue/)
</Message>
[Continue](https://www.continue.dev/) is an [open-source code assistant](https://github.com/continuedev/continue) to connect AI models to your IDE.

To get Continue, simply hit `install` in your IDE's marketplace:
- [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue)
- [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue)

## Configure Scaleway as an API provider in Continue

### Using Continue with your IDE
Continue can be used with VS Code to automate tasks, generate code, and enhance your coding experience. Here are some examples of how to use Continue with VS Code:
Continue's `config.json` file will set models and providers allowed for chat, autocompletion etc.
Here is an example configuration with Scaleway's OpenAI-compatible provider:

* Code generation: Use the `Continue: Generate Code` command to generate boilerplate code, functions, or entire classes.
* Code completion: Use the `Continue: Complete Code` command to complete partially written code.
* Code refactoring: Use the `Continue: Refactor Code` command to refactor code and improve its readability and maintainability.
```json
"models": [
{
"model": "qwen2.5-coder-32b-instruct",
"title": "Qwen2.5-coder",
"provider": "scaleway",
"apiKey": "###SCW SECRET KEY###"
}
]
```

<Message type="tip">
The config.json file is typically stored as `~/.continue/config.json` on Linux/macOS systems, and `%USERPROFILE%\.continue\config.json` on Windows.
</Message>

Read more about how to set up your `config.json` on the [official Continue documentation](https://docs.continue.dev/reference).

This file was deleted.

This file was deleted.

Loading