You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/generative-apis/how-to/query-code-models.mdx
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,15 @@ Code models are AI-powered tools that can understand, generate, and fix code. Wi
100
100
3. Restart your IDE after you have modified and saved the configuration file.
101
101
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.
102
102
103
+
<Messagetype="tip">
104
+
Refer our dedicated documentations for
105
+
-[Integrating Continue Dev with Visual Studio Code](/generative-apis/reference-content/adding-ai-to-vscode-using-continue/)
106
+
-[Integrating Continue Dev with IntelliJ IDEA](/generative-apis/reference-content/adding-ai-to-intellij-using-continue/)
107
+
for detailed information how to integrate Continue in your favourite IDE.
108
+
</Message>
109
+
110
+
111
+
103
112
### Using Continue with your IDE
104
113
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:
title: Integrating Scaleway Generative APIs with popular AI tools
4
-
description: Learn how to integrate Scaleway's Generative APIs with popular AI tools.
4
+
description: Learn how to integrate Scaleway's Generative APIs with popular AI tools to unlock the full potential of your applications.
5
5
content:
6
6
h1: Integrating Scaleway Generative APIs with popular AI tools
7
-
paragraph: Learn how to integrate Scaleway's Generative APIs with popular AI tools.
7
+
paragraph: Scaleway's Generative APIs provide a powerful way to integrate AI capabilities into your applications. By leveraging our APIs, you can tap into the latest advancements in natural language processing, computer vision, and more. In this guide, we'll show you how to integrate Scaleway's Generative APIs with popular AI tools like LangChain, LlamaIndex, and OpenAI.
8
8
tags: generative-apis, ai, language-models
9
-
validation_date: 2025-02-18
10
-
posted_date: 2025-02-18
9
+
dates:
10
+
validation: 2024-09-19
11
+
posted: 2024-09-19
11
12
---
12
13
13
-
Scaleway’s Generative APIs provide easy integration with various AI frameworks and tools. This guide outlines the configuration steps needed to integrate Scaleway's models into different environments.
14
+
Scaleway's Generative APIs are designed to provide easy access to the latest AI models and techniques. Our APIs are built on top of a robust infrastructure that ensures scalability, reliability, and security. With our APIs, you can integrate AI capabilities into your applications, such as text generation, image classification, and more.
15
+
16
+
## Comparison of AI tools and libraries
17
+
18
+
The following table compares AI tools and libraries supported by Scaleway's Generative APIs:
|[OpenAI](#openai-compatible-libraries)| Popular AI library for natural language processing | Text generation, language translation, text summarization | Low |
23
+
|[LangChain](#langchain-rag-and-llm-applications)| Library for building AI applications | Inference, embeddings, document indexing and retrieval | Medium |
24
+
|[LlamaIndex](#llamaindex-document-indexing-and-retrieval)| Library for indexing and retrieving documents using AI models | Document indexing and retrieval, question answering | Medium |
|[Transformers (Hugging Face)](#transformers-hugging-face-integration)| Library for pre-trained models for natural language processing | Text generation, language translation, text summarization | Medium |
27
+
|[cURL/Python](#api-clients-and-custom-integrations)| Direct API clients for custom integrations | Custom applications, data processing | High |
28
+
29
+
<Messagetype="note">
30
+
The integration effort is subjective and may vary depending on the specific use case and requirements.
31
+
</Message>
14
32
15
33
## OpenAI-Compatible libraries
16
-
Scaleway Generative APIs follow OpenAI’s API structure, making integration straightforward.
34
+
35
+
Scaleway Generative APIs follow OpenAI's API structure, making integration straightforward. To get started, you'll need to install the OpenAI library and set up your API key.
17
36
18
37
### Configuration
19
-
Set the API key and base URL in your OpenAI-compatible client:
20
38
39
+
To use the OpenAI library with Scaleway's Generative APIs, you'll need to set the API key and base URL in your OpenAI-compatible client:
21
40
```python
22
41
import openai
23
-
24
42
openai.api_key ="<API secret key>"
25
43
openai.api_base ="https://api.scaleway.ai/v1"
26
-
27
44
response = openai.ChatCompletion.create(
28
45
model="llama-3.1-8b-instruct",
29
46
messages=[{"role": "user", "content": "Tell me a joke about AI"}]
LlamaIndex enables easy document retrieval using Scaleway’s models.
106
+
LlamaIndex is a library for indexing and retrieving documents using AI models. Scaleway's Generative APIs support LlamaIndex for document indexing and retrieval.
67
107
68
108
### Configuration
69
-
1. Install dependencies:
70
-
```bash
71
-
pip install llama-index
72
-
```
73
-
2. Set up the embedding model:
74
-
```python
75
-
from llama_index.embeddings.openai import OpenAIEmbedding
76
-
77
-
embed_model = OpenAIEmbedding(
78
-
api_key="<API secret key>",
79
-
api_base="https://api.scaleway.ai/v1",
80
-
model="bge-multilingual-gemma2"
81
-
)
82
-
```
83
-
3. Index and query documents:
84
-
```python
85
-
from llama_index import VectorStoreIndex, SimpleDirectoryReader
index = VectorStoreIndex.from_documents(documents, embed_model=embed_model)
134
+
```
135
+
### Retrieving documents
136
+
137
+
To retrieve documents using LlamaIndex, you can call the `query` method on the `VectorStoreIndex` object:
138
+
```python
139
+
query_engine = index.as_query_engine()
140
+
response = query_engine.query("Summarize this document")
141
+
print(response)
142
+
```
94
143
95
144
## Continue Dev (AI coding assistance)
96
145
97
-
Continue Dev allows configuring Scaleway models for code completion.
146
+
Continue Dev is a library that provides AI-powered coding assistance. Scaleway's Generative APIs support Continue Dev for code completion and more.
147
+
148
+
<Messagetype="tip">
149
+
Refer our dedicated documentations for
150
+
-[Integrating Continue Dev with Visual Studio Code](/generative-apis/reference-content/adding-ai-to-vscode-using-continue/)
151
+
-[Integrating Continue Dev with IntelliJ IDEA](/generative-apis/reference-content/adding-ai-to-intellij-using-continue/)
152
+
</Message>
98
153
99
154
### Configuration
100
-
Modify `continue.json` to add Scaleway’s API:
101
155
156
+
To use Continue Dev with Scaleway's Generative APIs, you'll need to modify the `continue.json` file to add Scaleway's API:
102
157
```json
103
158
{
104
159
"models": [
@@ -116,39 +171,44 @@ Modify `continue.json` to add Scaleway’s API:
116
171
}
117
172
}
118
173
```
119
-
120
-
---
174
+
<Messagetype="tip">
175
+
Make sure to replace `<API secret key>` with your actual API key.
176
+
</Message>
121
177
122
178
## Transformers (Hugging Face integration)
123
179
124
-
Hugging Face’s `transformers` library can send requests to Scaleway-hosted models.
180
+
Hugging Face's `transformers` library provides a range of pre-trained models for natural language processing. Scaleway's Generative APIs support Hugging Face integration for text generation and more.
125
181
126
182
### Configuration
127
-
1. Install dependencies:
128
-
```bash
129
-
pip install transformers requests
130
-
```
131
-
2. Use a custom API endpoint:
132
-
```python
133
-
from transformers import pipeline
134
-
135
-
generator = pipeline(
136
-
"text-generation",
137
-
model="llama-3.1-8b-instruct",
138
-
tokenizer="meta-llama/Llama-3-8b",
139
-
api_base="https://api.scaleway.ai/v1",
140
-
api_key="<API secret key>"
141
-
)
142
-
143
-
print(generator("Write a short poem about the ocean"))
144
-
```
145
183
146
-
---
184
+
To use Hugging Face with Scaleway's Generative APIs, you'll need to install the `transformers` library and set up your API key:
185
+
```python
186
+
from transformers import pipeline
187
+
generator = pipeline(
188
+
"text-generation",
189
+
model="llama-3.1-8b-instruct",
190
+
tokenizer="meta-llama/Llama-3-8b",
191
+
api_base="https://api.scaleway.ai/v1",
192
+
api_key="<API secret key>"
193
+
)
194
+
```
195
+
<Messagetype="tip">
196
+
Make sure to replace `<API secret key>` with your actual API key.
197
+
</Message>
198
+
199
+
### Using Hugging Face for text generation
147
200
201
+
To use Hugging Face for text generation, you can call the `generator` function:
202
+
```python
203
+
print(generator("Write a short poem about the ocean"))
204
+
```
148
205
## API clients & custom integrations
149
-
You can interact with Scaleway’s Generative APIs directly using any HTTP client.
206
+
207
+
You can interact with Scaleway's Generative APIs directly using any HTTP client.
150
208
151
209
### cURL example
210
+
211
+
To use cURL with Scaleway's Generative APIs, you can use the following command:
0 commit comments