The integration effort is subjective and may vary depending on the specific use case and requirements.
Integrating Scaleway Generative APIs with popular AI tools
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.
Comparison of AI tools and librariesLink to this anchor
The following table compares AI tools and libraries supported by Scaleway’s Generative APIs:
Tool/Library | Description | Use cases | Integration effort |
---|---|---|---|
OpenAI client | Popular AI library for natural language processing | Text generation, language translation, text summarization | Low |
LangChain | Library for building AI applications leveraging RAG | Inference, embeddings, document indexing and retrieval | Medium |
LlamaIndex | Library for building advanced AI RAG applications | Knowledge graph building, document retrieval, data indexing | Medium |
Continue Dev | IDE extension for AI-powered coding assistance | Code completion, code review | Low |
Zed AI | IDE including AI-powered coding assistance | Code completion, code review | Low |
Chatbox AI | Desktop client for generative APIs, available on Windows, Mac, Linux | AI copilot for documents, images, or code | Low |
cURL/Python | Direct HTTP API calls for custom integrations | Custom applications, data processing | High |
OpenAI client librariesLink to this anchor
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.
ConfigurationLink to this anchor
To use the OpenAI client library with Scaleway’s Generative APIs, first install the required dependencies:
pip install openai
Then set the API key and base URL in your OpenAI-compatible client:
from openai import OpenAIclient = OpenAI(base_url="https://api.scaleway.ai/v1",api_key="<API secret key>")
Make sure to replace <API secret key>
with your actual API key.
Using OpenAI client for text generationLink to this anchor
To use OpenAI client for text generation, you can create a client.chat.completions
object and call the create
method:
response = client.chat.completions.create(model="llama-3.1-8b-instruct",messages=[{"role": "user", "content": "Tell me a joke about AI"}])print(response.choices[0].message.content)
LangChain (RAG & LLM applications)Link to this anchor
LangChain is a popular library for building AI applications. Scaleway’s Generative APIs support LangChain for both inference and embeddings.
PythonLink to this anchor
Refer to our dedicated documentation for implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs
LlamaIndex (advanced RAG applications)Link to this anchor
LlamaIndex is an open-source framework for building Large Language Models (LLMs) based applications, especially optimizing RAG (Retrieval Augmented Generation) pipelines.
-
Install the required dependencies to use the LlamaIndex framework with Scaleway’s Generative APIs:
pip install llama-index-llms-openai-like -
Create a file
main.py
and add the following code to it to configure theOpenAILike
client and your secret key:from llama_index.llms.openai_like import OpenAILikefrom llama_index.core.llms import ChatMessagellm = OpenAILike(model="llama-3.1-8b-instruct",api_key="<API secret key>",api_base="https://api.scaleway.ai/v1",max_tokens=512,temperature=0.7,top_p=1,presence_penalty=0,)TipMake sure to replace
<API secret key>
with your actual API key. -
You can then interact with the LLM by sending messages to the model with the following code:
response = llm.chat([ChatMessage("Could you tell me about Scaleway please ?")])print(response) -
Finally, run
main.py
:python main.pyThe LLM response should display an answer:
Generally, Scaleway is a reliable and secure cloud provider that offers a range of services for businesses and developers.
Javascript (Typescript)Link to this anchor
To perform chat conversations with Langchain, first install langchain
and @langchain/openai
packages using your node package manager.
-
Use the following command to install Langchain using
npm
(yarn
andpnpm
are also available):npm install langchain @langchain/openai -
Edit your
package.json
file to ensure it has the"type": "module"
property:{"type": "module","dependencies": {"@langchain/openai": "^0.4.4","langchain": "^0.3.19"}} -
Create a
main.js
file and add the following content to it:import { ChatOpenAI } from "@langchain/openai";const chat = new ChatOpenAI({apiKey: "<API secret key>",model: "llama-3.1-8b-instruct",configuration: {baseURL: "https://api.scaleway.ai/v1",}});const response = await chat.invoke("Tell me a joke");console.log(response.content);TipMake sure to replace
<API secret key>
with your actual API secret key. -
Run
main.js
:node main.jsThe model answer should display:
Why couldn't the bicycle stand up by itself? Because it was two-tired.
Note that other Langchain objects from OpenAI client library are also compatible, such as OpenAI
and OpenAIEmbeddings
.
Continue Dev (AI coding assistance)Link to this anchor
Continue Dev is a library that provides AI-powered coding assistance. Scaleway’s Generative APIs support Continue Dev for code completion and more.
Refer to our dedicated documentation for
Zed AI (coding assistance)Link to this anchor
Zed is an IDE (Integrated Development Environment) including AI coding assistance support. Scaleway’s Generative APIs support Zed AI code completion and more.
Refer to our dedicated documentation for connecting Zed to Generative APIs
Chatbox AILink to this anchor
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.
Refer to our dedicated documentation for installing and configuring Chatbox AI with Generative APIs
Custom HTTP integrationsLink to this anchor
You can interact with Scaleway’s Generative APIs directly using any HTTP client.
cURL exampleLink to this anchor
To use cURL with Scaleway’s Generative APIs, you can use the following command:
curl https://api.scaleway.ai/v1/chat/completions \-H "Authorization: Bearer <API secret key>" \-H "Content-Type: application/json" \-d '{"model": "llama-3.1-8b-instruct","messages": [{"role": "user", "content": "What is quantum computing?"}]}'
Make sure to replace <API secret key>
with your actual API key.
Python HTTP exampleLink to this anchor
To perform HTTP requests with Scaleway’s Generative APIs, install the requests
dependency:
pip install requests
Then, you can use the following code:
import requestsheaders = {"Authorization": "Bearer <API secret key>","Content-Type": "application/json"}data = {"model": "llama-3.1-8b-instruct","messages": [{"role": "user", "content": "Explain black holes"}]}response = requests.post("https://api.scaleway.ai/v1/chat/completions", json=data, headers=headers)print(response.json()["choices"][0]["message"]["content"])
Make sure to replace <API secret key>
with your actual API key.