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
h1: Integrating Scaleway Generative APIs with popular AI tools
7
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
-
tags: generative-apis, ai, language-models
8
+
tags: generative-apis ai language-models
9
9
dates:
10
10
validation: 2025-02-18
11
11
posted: 2025-02-18
@@ -19,129 +19,58 @@ The following table compares AI tools and libraries supported by Scaleway's Gene
|[OpenAI](#openai-compatible-libraries)| Popular AI library for natural language processing | Text generation, language translation, text summarization | Low |
22
+
|[OpenAI client](#openai-client-libraries)| Popular AI library for natural language processing | Text generation, language translation, text summarization | Low |
23
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 |
|[Chatbox AI](#chatbox-ai)| Desktop client for generative APIs, available on Windows, Mac, Linux | AI copilot for documents, images, or code| Low |
27
-
|[Transformers (Hugging Face)](#transformers-hugging-face-integration)| Library for pre-trained models for natural language processing | Text generation, language translation, text summarization | Medium |
28
-
|[cURL/Python](#api-clients-and-custom-integrations)| Direct API clients for custom integrations | Custom applications, data processing | High |
26
+
|[cURL/Python](#custom-http-integrations)| Direct HTTP API calls for custom integrations | Custom applications, data processing | High |
29
27
30
28
<Messagetype="note">
31
29
The integration effort is subjective and may vary depending on the specific use case and requirements.
32
30
</Message>
33
31
34
-
## OpenAI-compatible libraries
32
+
## OpenAI client libraries
35
33
36
34
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.
37
35
38
36
### Configuration
39
37
40
-
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:
38
+
To use the OpenAI client library with Scaleway's Generative APIs, first install the required dependencies:
39
+
```bash
40
+
pip install openai
41
+
```
42
+
43
+
Then set the API key and base URL in your OpenAI-compatible client:
41
44
```python
42
-
import openai
43
-
openai.api_key ="<API secret key>"
44
-
openai.api_base ="https://api.scaleway.ai/v1"
45
-
response = openai.ChatCompletion.create(
46
-
model="llama-3.1-8b-instruct",
47
-
messages=[{"role": "user", "content": "Tell me a joke about AI"}]
LlamaIndex is a library for indexing and retrieving documents using AI models. Scaleway's Generative APIs support LlamaIndex for document indexing and retrieval.
108
-
109
-
### Configuration
110
-
111
-
To use LlamaIndex with Scaleway's Generative APIs, you'll need to install the required dependencies:
112
-
```bash
113
-
pip install llama-index
114
-
```
115
-
Next, set up the embedding model:
116
-
```python
117
-
from llama_index.embeddings.openai import OpenAIEmbedding
118
-
embed_model = OpenAIEmbedding(
119
-
api_key="<API secret key>",
120
-
api_base="https://api.scaleway.ai/v1",
121
-
model="bge-multilingual-gemma2"
122
-
)
123
-
```
124
70
<Messagetype="tip">
125
-
Make sure to replace `<API secret key>`with your actual API key.
71
+
Refer to our dedicated documentation for [implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs](/tutorials/how-to-implement-rag-generativeapis/)
126
72
</Message>
127
73
128
-
### Indexing documents
129
-
130
-
To index documents using LlamaIndex, you'll need to create a `VectorStoreIndex` object and call the `add_documents` method:
131
-
```python
132
-
from llama_index import VectorStoreIndex, SimpleDirectoryReader
index = VectorStoreIndex.from_documents(documents, embed_model=embed_model)
135
-
```
136
-
### Retrieving documents
137
-
138
-
To retrieve documents using LlamaIndex, you can call the `query` method on the `VectorStoreIndex` object:
139
-
```python
140
-
query_engine = index.as_query_engine()
141
-
response = query_engine.query("Summarize this document")
142
-
print(response)
143
-
```
144
-
145
74
## Continue Dev (AI coding assistance)
146
75
147
76
Continue Dev is a library that provides AI-powered coding assistance. Scaleway's Generative APIs support Continue Dev for code completion and more.
@@ -152,30 +81,6 @@ Continue Dev is a library that provides AI-powered coding assistance. Scaleway's
152
81
-[Integrating Continue Dev with IntelliJ IDEA](/generative-apis/reference-content/adding-ai-to-intellij-using-continue/)
153
82
</Message>
154
83
155
-
### Configuration
156
-
157
-
To use Continue Dev with Scaleway's Generative APIs, you'll need to modify the `continue.json` file to add Scaleway's API:
158
-
```json
159
-
{
160
-
"models": [
161
-
{
162
-
"title": "Qwen2.5-Coder-32B-Instruct",
163
-
"provider": "scaleway",
164
-
"model": "qwen2.5-coder-32b-instruct",
165
-
"apiKey": "<API secret key>"
166
-
}
167
-
],
168
-
"embeddingsProvider": {
169
-
"provider": "scaleway",
170
-
"model": "bge-multilingual-gemma2",
171
-
"apiKey": "<API secret key>"
172
-
}
173
-
}
174
-
```
175
-
<Messagetype="tip">
176
-
Make sure to replace `<API secret key>` with your actual API key.
177
-
</Message>
178
-
179
84
## Chatbox AI
180
85
181
86
Chatbox AI is a powerful AI client and smart assistant, compatible with Scaleway's Generative APIs service. It is available across multiple platforms, including Windows, macOS, Android, iOS, Web, and Linux.
@@ -184,35 +89,7 @@ Chatbox AI is a powerful AI client and smart assistant, compatible with Scaleway
184
89
Refer to our dedicated documentation for [installing and configuring Chatbox AI with Generative APIs](/tutorials/configure-chatboxai-with-generative-apis/)
185
90
</Message>
186
91
187
-
188
-
## Transformers (Hugging Face integration)
189
-
190
-
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.
191
-
192
-
### Configuration
193
-
194
-
To use Hugging Face with Scaleway's Generative APIs, you'll need to install the `transformers` library and set up your API key:
195
-
```python
196
-
from transformers import pipeline
197
-
generator = pipeline(
198
-
"text-generation",
199
-
model="llama-3.1-8b-instruct",
200
-
tokenizer="meta-llama/Llama-3-8b",
201
-
api_base="https://api.scaleway.ai/v1",
202
-
api_key="<API secret key>"
203
-
)
204
-
```
205
-
<Messagetype="tip">
206
-
Make sure to replace `<API secret key>` with your actual API key.
207
-
</Message>
208
-
209
-
### Using Hugging Face for text generation
210
-
211
-
To use Hugging Face for text generation, you can call the `generator` function:
212
-
```python
213
-
print(generator("Write a short poem about the ocean"))
214
-
```
215
-
## API clients and custom integrations
92
+
## Custom HTTP integrations
216
93
217
94
You can interact with Scaleway's Generative APIs directly using any HTTP client.
0 commit comments