Skip to content

Commit 50ac87a

Browse files
bene2k1Laure-di
authored andcommitted
feat(genai): add content for Continue Dev documentation for GenAPIs (scaleway#4414)
1 parent 6822910 commit 50ac87a

File tree

5 files changed

+577
-31
lines changed

5 files changed

+577
-31
lines changed

menu/navigation.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,18 @@
956956
{
957957
"label": "Data privacy",
958958
"slug": "data-privacy"
959+
},
960+
{
961+
"label": "Adding AI to VS Code using Continue",
962+
"slug": "adding-ai-to-vscode-using-continue"
963+
},
964+
{
965+
"label": "Adding AI to IntelliJ IDEA using Continue",
966+
"slug": "adding-ai-to-intellij-using-continue"
967+
},
968+
{
969+
"label": "Integrating Generative APIs with popular AI tools",
970+
"slug": "integrating-generative-apis-with-popular-tools"
959971
}
960972
],
961973
"label": "Additional Content",
Lines changed: 96 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
meta:
3-
title: How to query code models
4-
description: Learn how to interact with powerful language models specialized in code using Scaleway's Generative APIs service.
3+
title: How to query code models with Scaleway's Generative APIs
4+
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.
55
content:
6-
h1: How to query code models
7-
paragraph: Learn how to interact with powerful language models specialized in code using Scaleway's Generative APIs service.
8-
tags: generative-apis ai-data language-models code-models chat-completions-api
6+
h1: How to query code models with Scaleway's Generative APIs
7+
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.
8+
tags: generative-apis ai-data language-models code-models chat-completions-api scaleway-continue vs-code intellij
99
dates:
10-
validation: 2024-12-09
10+
validation: 2025-02-14
1111
posted: 2024-12-09
1212
---
1313

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

33-
## Install Continue in your IDE
34-
35-
[Continue](https://www.continue.dev/) is an [open-source code assistant](https://github.com/continuedev/continue) to connect AI models to your IDE.
36-
37-
To get Continue, simply hit `install` in your IDE's marketplace:
38-
- [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue)
39-
- [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue)
40-
41-
## Configure Scaleway as an API provider in Continue
42-
43-
Continue's `config.json` file will set models and providers allowed for chat, autocompletion etc.
44-
Here is an example configuration with Scaleway's OpenAI-compatible provider:
45-
46-
```json
47-
"models": [
48-
{
49-
"model": "qwen2.5-coder-32b-instruct",
50-
"title": "Qwen2.5-coder",
51-
"provider": "scaleway",
52-
"apiKey": "###SCW SECRET KEY###"
53-
}
54-
]
55-
```
34+
### Querying code models with Scaleway's Generative APIs
35+
36+
1. Set up the OpenAI Python SDK:
37+
- Install the SDK by running:
38+
```bash
39+
pip install openai
40+
```
41+
- Configure the SDK with your API key and Scaleway's API base URL:
42+
```python
43+
from openai import OpenAI
44+
45+
client = OpenAI(
46+
base_url="https://api.scaleway.ai/v1",
47+
api_key="###SCW_SECRET_KEY###"
48+
)
49+
```
50+
Replace `"###SCW_SECRET_KEY###"` with your actual API secret key.
51+
52+
2. Make an API request:
53+
- To generate code or receive assistance, send a request to the chat completion endpoint:
54+
```python
55+
completion = client.chat.completions.create(
56+
model="qwen2.5-coder-32b-instruct",
57+
messages=[{"role": "user", "content": "Write a Python function to sort a list using quicksort."}],
58+
temperature=0.7,
59+
max_tokens=150
60+
)
61+
62+
print(completion.choices[0].message.content)
63+
```
64+
This will generate a Python function implementing the quicksort algorithm.
65+
66+
67+
## Integrating Continue in VS Code and JetBrains IntelliJ
68+
69+
[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:
70+
71+
* [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue)
72+
* [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue)
73+
74+
### Installation of Continue
75+
76+
#### For Visual Studio Code
77+
78+
1. Open VS Code and navigate to the **Extensions** view (`Ctrl+Shift+X`).
79+
2. Type `Continue` in the search bar and click **Install**.
80+
3. The **Continue** icon should appear on the sidebar.
81+
82+
#### For JetBrains IntelliJ
83+
84+
1. Open your JetBrains IDE and go to **Settings** (`Ctrl+Alt+S`).
85+
2. Select **Plugins** and search for `Continue` in the marketplace.
86+
3. Click **Install**. The `Continue` icon should appear on the toolbar.
87+
88+
### Configuration of Continue
89+
90+
1. Locate the configuration file. The `config.json` file is typically found at:
91+
- `~/.continue/config.json` on Linux/macOS
92+
- `%USERPROFILE%\.continue\config.json` on Windows
93+
94+
2. Configure Continue to use Scaleway's API:
95+
- Add the following configuration:
96+
```json
97+
{
98+
"models": [
99+
{
100+
"model": "qwen2.5-coder-32b-instruct",
101+
"title": "Qwen2.5-coder",
102+
"provider": "scaleway",
103+
"apiKey": "###SCW_SECRET_KEY###"
104+
}
105+
]
106+
}
107+
```
108+
<Message type="tip">
109+
Read more about how to set up your `config.json` on the [official Continue documentation](https://docs.continue.dev/reference).
110+
</Message>
111+
3. Restart your IDE after you have modified and saved the configuration file.
112+
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.
56113

57114
<Message type="tip">
58-
The config.json file is typically stored as `~/.continue/config.json` on Linux/macOS systems, and `%USERPROFILE%\.continue\config.json` on Windows.
115+
Refer to our dedicated documentation for detailed information on how to integrate Continue in your favourite IDE.
116+
- [Integrating Continue Dev with Visual Studio Code](/generative-apis/reference-content/adding-ai-to-vscode-using-continue/)
117+
- [Integrating Continue Dev with IntelliJ IDEA](/generative-apis/reference-content/adding-ai-to-intellij-using-continue/)
59118
</Message>
60119

61-
Read more about how to set up your `config.json` on the [official Continue documentation](https://docs.continue.dev/reference).
120+
### Using Continue with your IDE
121+
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:
122+
123+
* Code generation: Use the `Continue: Generate Code` command to generate boilerplate code, functions, or entire classes.
124+
* Code completion: Use the `Continue: Complete Code` command to complete partially written code.
125+
* Code refactoring: Use the `Continue: Refactor Code` command to refactor code and improve its readability and maintainability.
126+
62127

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
meta:
3+
title: Adding AI to IntelliJ IDEA using Continue and Generative APIs
4+
description: Learn how to integrate AI-powered code models into IntelliJ IDEA with Continue and Scaleway's Generative APIs.
5+
content:
6+
h1: Adding AI to IntelliJ IDEA using Continue and Generative APIs
7+
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.
8+
tags: generative-apis, ai, machine-learning, language-models, code-assistance, intellij-idea, continue
9+
validation_date: 2025-02-14
10+
posted_date: 2025-02-14
11+
---
12+
13+
AI-driven coding is revolutionizing software development by automating repetitive tasks, generating code snippets, improving code quality, and identifying potential bugs.
14+
By integrating AI-powered tools, developers can significantly enhance productivity and optimize workflows.
15+
This guide will help you integrate AI-powered code models into JetBrain's IntelliJ IDEA using Continue and Scaleway’s Generative APIs.
16+
17+
<Macro id="requirements" />
18+
19+
- A Scaleway account logged into the [console](https://console.scaleway.com)
20+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
21+
- A valid [API key](/iam/how-to/create-api-keys/) for API authentication
22+
- Installed [IntelliJ IDEA](https://www.jetbrains.com/idea/) on your local machine.
23+
24+
## Install Continue in IntelliJ IDEA
25+
26+
You can install Continue from the [JetBrains marketplace](https://plugins.jetbrains.com/plugin/22707-continue):
27+
28+
1. Open IntelliJ IDEA and go to **Preferences** (`Ctrl+Alt+S` on Windows/Linux, `Cmd+,` on macOS).
29+
2. Navigate to **Plugins**, then click **Marketplace**.
30+
3. Search for **Continue** and click **Install**.
31+
4. Restart IntelliJ IDEA after installation.
32+
33+
### Configure Continue to use Scaleway’s Generative APIs
34+
35+
To link Continue with Scaleway’s Generative APIs, you need to configure the settings file:
36+
37+
1. Locate your Continue configuration directory:
38+
- **Linux/macOS**: `~/.continue/`
39+
- **Windows**: `%USERPROFILE%\.continue\`
40+
2. Create a `config.json` file inside this directory.
41+
3. Add the following configuration:
42+
```json
43+
{
44+
"models": [
45+
{
46+
"model": "qwen2.5-coder-32b-instruct",
47+
"title": "Qwen2.5 Coder",
48+
"provider": "scaleway",
49+
"apiKey": "###SCW_SECRET_KEY###"
50+
}
51+
]
52+
}
53+
```
54+
4. Save the file and restart IntelliJ IDEA.
55+
56+
<Message type="tip">
57+
For more details on configuring `config.json`, refer to the [official Continue documentation](https://docs.continue.dev/reference).
58+
</Message>
59+
60+
### Activate Continue in IntelliJ IDEA
61+
62+
After configuring the API, activate Continue in IntelliJ IDEA:
63+
64+
- Open the **Command Search** (`Shift+Shift` on Windows/Linux/macOS).
65+
- Type `"Continue"` and select the appropriate command to enable AI-powered assistance.
66+
67+
## Using Continue for AI-powered coding
68+
69+
Once Continue is configured, you can leverage AI capabilities to streamline development. Below are some key features:
70+
71+
### AI-assisted code generation
72+
73+
Use the `Continue: Generate Code` command to generate boilerplate code, functions, or even entire classes based on natural language prompts.
74+
75+
#### Example:
76+
77+
- Input Prompt: *"Create a Java method to validate an email address."*
78+
- AI-generated output:
79+
```java
80+
import java.util.regex.Pattern;
81+
82+
public class EmailValidator {
83+
private static final String EMAIL_REGEX = "^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$";
84+
private static final Pattern pattern = Pattern.compile(EMAIL_REGEX);
85+
86+
public static boolean isValidEmail(String email) {
87+
return pattern.matcher(email).matches();
88+
}
89+
}
90+
```
91+
92+
### Intelligent code completion
93+
94+
Continue enhances your coding workflow with AI-driven code completion. Simply start typing, and the AI model will suggest and complete your code efficiently.
95+
96+
### Automated code refactoring
97+
98+
Refactoring is crucial for maintaining clean and efficient code. Use the `Continue: Refactor Code` command to enhance readability and optimize performance.
99+
100+
#### Example
101+
102+
- Before refactoring:
103+
```java
104+
public int calculateSum(int a, int b) {
105+
int result = a + b;
106+
return result;
107+
}
108+
```
109+
110+
- After AI-driven refactoring:
111+
```java
112+
public int calculateSum(int a, int b) {
113+
return a + b;
114+
}
115+
```
116+
117+
## Conclusion
118+
119+
By integrating Continue with Scaleway’s Generative APIs, you unlock AI-powered coding capabilities that enhance productivity, automate repetitive tasks, and improve code quality.
120+
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
meta:
3+
title: Adding AI to VS Code using Continue and Generative APIs
4+
description: Learn how to integrate AI-powered code models into VS Code with Continue and Scaleway's Generative APIs.
5+
content:
6+
h1: Adding AI to VS Code using Continue and Generative APIs
7+
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.
8+
tags: generative-apis, ai, machine-learning, language-models, code-assistance, vs-code, continue
9+
validation_date: 2025-02-14
10+
posted_date: 2025-02-14
11+
---
12+
13+
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.
14+
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.
15+
16+
<Macro id="requirements" />
17+
18+
- A Scaleway account logged into the [console](https://console.scaleway.com)
19+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
20+
- A valid [API key](/iam/how-to/create-api-keys/) for API authentication
21+
- Installed [Visual Studio Code](https://code.visualstudio.com/) on your local machine
22+
23+
## Install Continue in VS Code
24+
25+
You can install Continue directly from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or via the command line:
26+
27+
```bash
28+
code --install-extension continue.continue
29+
```
30+
31+
### Configure Continue to use Scaleway’s Generative APIs
32+
33+
To link Continue with Scaleway's Generative APIs, you need to configure a settings file:
34+
35+
- Create a `config.json` file inside your `.continue` directory.
36+
- Add the following configuration to enable Scaleway's Generative API:
37+
```json
38+
{
39+
"models": [
40+
{
41+
"model": "qwen2.5-coder-32b-instruct",
42+
"title": "Qwen2.5 Coder",
43+
"provider": "scaleway",
44+
"apiKey": "###SCW_SECRET_KEY###"
45+
}
46+
]
47+
}
48+
```
49+
- Save the file at the correct location:
50+
- Linux/macOS: `~/.continue/config.json`
51+
- Windows: `%USERPROFILE%\.continue\config.json`
52+
53+
<Message type="tip">
54+
For more details on configuring `config.json`, refer to the [official Continue documentation](https://docs.continue.dev/reference).
55+
</Message>
56+
57+
### Activate Continue in VS Code
58+
59+
After configuring the API, open VS Code and activate Continue:
60+
61+
- Open the **Command Palette** (`Ctrl+Shift+P` on Windows/Linux, `Cmd+Shift+P` on Mac)
62+
- Type `"Continue"` and select the appropriate command to enable AI-powered assistance.
63+
64+
## Using Continue for AI-powered coding
65+
66+
Once Continue is configured, you can leverage AI capabilities to streamline development. Below are some key features:
67+
68+
### AI-assisted code generation
69+
70+
Use the "Continue: Generate Code" command to generate boilerplate code, functions, or even entire classes based on natural language prompts.
71+
72+
#### Example
73+
74+
- Input prompt: *"Create a Python function to merge two sorted lists"*
75+
- AI-Generated output:
76+
```python
77+
def merge_sorted_lists(list1, list2):
78+
return sorted(list1 + list2)
79+
```
80+
81+
### Intelligent code completion
82+
83+
Continue enhances your coding workflow with AI-driven code completion. Simply start typing, and the AI model will predict and complete your code.
84+
85+
### Automated code refactoring
86+
87+
Refactoring is essential for maintaining clean and efficient code. Use the *"Continue: Refactor Code"* command to improve readability and optimize performance.
88+
89+
#### Example
90+
91+
- Before refactoring:
92+
```python
93+
def add_numbers(a, b):
94+
result = a + b
95+
return result
96+
```
97+
98+
- After AI-driven refactoring:
99+
```python
100+
def add_numbers(a, b):
101+
return a + b
102+
```
103+
104+
## Conclusion
105+
106+
By integrating Continue with Scaleway’s Generative APIs, you unlock AI-powered coding capabilities that enhance productivity, automate repetitive tasks, and improve code quality.

0 commit comments

Comments
 (0)