Skip to content
12 changes: 12 additions & 0 deletions menu/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,18 @@
{
"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
128 changes: 97 additions & 31 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
description: Learn how to interact with powerful language models specialized in code using Scaleway's Generative APIs service.
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.
content:
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
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
dates:
validation: 2024-12-09
validation: 2025-02-14
posted: 2024-12-09
---

Expand All @@ -28,35 +28,101 @@ 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

## Install Continue in your IDE

[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

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:

```json
"models": [
{
"model": "qwen2.5-coder-32b-instruct",
"title": "Qwen2.5-coder",
"provider": "scaleway",
"apiKey": "###SCW SECRET KEY###"
}
]
```
### 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 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. Search for "Continue" and click `Install`.
3. The Continue icon will 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`, and the Continue icon will 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.

<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.
Refer our dedicated documentation for
- [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/)
for detailed information how to integrate Continue in your favourite IDE.
</Message>

Read more about how to set up your `config.json` on the [official Continue documentation](https://docs.continue.dev/reference).
### 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:

* 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.


Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
meta:
title: Adding AI to IntelliJ IDEA using Continue and Generative APIs
description: Learn how to integrate AI-powered code models into IntelliJ IDEA with Continue and Scaleway's Generative APIs.
content:
h1: Adding AI to IntelliJ IDEA using Continue and Generative APIs
paragraph: Improve your coding efficiency by integrating AI-powered code models into IntelliJ IDEA. With Continue and Scaleway's Generative APIs, you can use AI to understand, generate, and optimize code.
tags: generative-apis, ai, machine-learning, language-models, code-assistance, intellij-idea, continue
validation_date: 2025-02-14
posted_date: 2025-02-14
---

AI-driven coding is revolutionizing software development by automating repetitive tasks, generating code snippets, improving code quality, and identifying potential bugs.
By integrating AI-powered tools, developers can significantly enhance productivity and optimize workflows.
This guide will help you integrate AI-powered code models into JetBrain's IntelliJ IDEA using Continue and Scaleway’s Generative APIs.

<Macro id="requirements" />

- 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
- Installed [IntelliJ IDEA](https://www.jetbrains.com/idea/) on your local machine.

## Install Continue in IntelliJ IDEA

You can install Continue from [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue):

1. Open IntelliJ IDEA and go to **Preferences** (`Ctrl+Alt+S` on Windows/Linux, `Cmd+,` on macOS).
2. Navigate to **Plugins** > **Marketplace**.
3. Search for **Continue** and click **Install**.
4. Restart IntelliJ IDEA after installation.

### Configure Continue to use Scaleway’s Generative APIs

To link Continue with Scaleway’s Generative APIs, you need to configure the settings file:

1. Locate your Continue configuration directory:
- **Linux/macOS**: `~/.continue/`
- **Windows**: `%USERPROFILE%\.continue\`
2. Create a `config.json` file inside this directory.
3. Add the following configuration:
```json
{
"models": [
{
"model": "qwen2.5-coder-32b-instruct",
"title": "Qwen2.5 Coder",
"provider": "scaleway",
"apiKey": "###SCW_SECRET_KEY###"
}
]
}
```
4. Save the file and restart IntelliJ IDEA.

<Message type="tip">
For more details on configuring `config.json`, refer to the [official Continue documentation](https://docs.continue.dev/reference).
</Message>

### Activate Continue in IntelliJ IDEA

After configuring the API, activate Continue in IntelliJ IDEA:

- Open the **Command Search** (`Shift+Shift` on Windows/Linux/macOS).
- Type `"Continue"` and select the appropriate command to enable AI-powered assistance.

## Using Continue for AI-powered coding

Once Continue is configured, you can leverage AI capabilities to streamline development. Below are some key features:

### AI-assisted code generation

Use the **Continue: Generate Code** command to generate boilerplate code, functions, or even entire classes based on natural language prompts.

#### Example:

- Input Prompt: *"Create a Java method to validate an email address."*
- AI-generated output:
```java
import java.util.regex.Pattern;

public class EmailValidator {
private static final String EMAIL_REGEX = "^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$";
private static final Pattern pattern = Pattern.compile(EMAIL_REGEX);

public static boolean isValidEmail(String email) {
return pattern.matcher(email).matches();
}
}
```

### Intelligent code completion

Continue enhances your coding workflow with AI-driven code completion. Simply start typing, and the AI model will suggest and complete your code efficiently.

### Automated code refactoring

Refactoring is crucial for maintaining clean and efficient code. Use the *Continue: Refactor Code* command to enhance readability and optimize performance.

#### Example

- Before refactoring:
```java
public int calculateSum(int a, int b) {
int result = a + b;
return result;
}
```

- After AI-driven refactoring:
```java
public int calculateSum(int a, int b) {
return a + b;
}
```

## Conclusion

By integrating Continue with Scaleway’s Generative APIs, you unlock AI-powered coding capabilities that enhance productivity, automate repetitive tasks, and improve code quality.

Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
meta:
title: Adding AI to VS Code using Continue and Generative APIs
description: Learn how to integrate AI-powered code models into VS Code with Continue and Scaleway's Generative APIs.
content:
h1: Adding AI to VS Code using Continue and Generative APIs
paragraph: Elevate your coding experience by integrating AI-powered code models into VS Code. With Continue and Scaleway's Generative APIs, you can leverage AI to understand, generate, and optimize code with ease.
tags: generative-apis, ai, machine-learning, language-models, code-assistance, vs-code, continue
validation_date: 2025-02-14
posted_date: 2025-02-14
---

AI-powered coding is transforming software development by automating repetitive tasks, generating code, improving code quality, and even detecting and fixing bugs. By integrating AI-driven tools, developers can significantly boost productivity and streamline their workflows.
This guide provides a step-by-step guide on how to integrate AI-powered code models into VS Code using Continue and Scaleway's Generative APIs.

<Macro id="requirements" />

- 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
- Installed [Visual Studio Code](https://code.visualstudio.com/) on your local machine

## Install Continue in VS Code

You can install Continue directly from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or via the command line:

```bash
code --install-extension continue.continue
```

### Configure Continue to use Scaleway’s Generative APIs

To link Continue with Scaleway's Generative APIs, you need to configure a settings file:

- Create a `config.json` file inside your `.continue` directory.
- Add the following configuration to enable Scaleway's Generative API:
```json
{
"models": [
{
"model": "qwen2.5-coder-32b-instruct",
"title": "Qwen2.5 Coder",
"provider": "scaleway",
"apiKey": "###SCW_SECRET_KEY###"
}
]
}
```
- Save the file at the correct location:
- Linux/macOS: `~/.continue/config.json`
- Windows: `%USERPROFILE%\.continue\config.json`

<Message type="tip">
For more details on configuring `config.json`, refer to the [official Continue documentation](https://docs.continue.dev/reference).
</Message>

### Activate Continue in VS Code

After configuring the API, open VS Code and activate Continue:

- Open the **Command Palette** (`Ctrl+Shift+P` on Windows/Linux, `Cmd+Shift+P` on Mac)
- Type `"Continue"` and select the appropriate command to enable AI-powered assistance.

## Using Continue for AI-powered coding

Once Continue is configured, you can leverage AI capabilities to streamline development. Below are some key features:

### AI-assisted code generation

Use the "Continue: Generate Code" command to generate boilerplate code, functions, or even entire classes based on natural language prompts.

#### Example

- Input prompt: *"Create a Python function to merge two sorted lists"*
- AI-Generated output:
```python
def merge_sorted_lists(list1, list2):
return sorted(list1 + list2)
```

### Intelligent code completion

Continue enhances your coding workflow with AI-driven code completion. Simply start typing, and the AI model will predict and complete your code.

### Automated code refactoring

Refactoring is essential for maintaining clean and efficient code. Use the *"Continue: Refactor Code"* command to improve readability and optimize performance.

#### Example

- Before refactoring:
```python
def add_numbers(a, b):
result = a + b
return result
```

- After AI-driven refactoring:
```python
def add_numbers(a, b):
return a + b
```

## Conclusion

By integrating Continue with Scaleway’s Generative APIs, you unlock AI-powered coding capabilities that enhance productivity, automate repetitive tasks, and improve code quality.
Loading
Loading