From 3fc9f7fb74c32ebfe863efa66d04db2ec9342a3b Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 12:30:40 +0100 Subject: [PATCH 01/11] Update adding-ai-to-vscode-using-continue.mdx Adding Continue setup procedure using graphical interface. --- .../adding-ai-to-vscode-using-continue.mdx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx index 898dd6bf8c..048b71d4af 100644 --- a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx +++ b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx @@ -30,7 +30,21 @@ 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: +#### Configure Continue through graphical interface + +To link Continue with Scaleway's Generative APIs, you can use built-in menus from Continue in VS Code. + +- Select Continue on the left menu. +- In the prompt section, click on **Select model** dropdown, then on **Add Chat model**. +- Select **Scaleway** as provider. +- Select the model you want to use (we recommend `Qwen 2.5 Coder 32b` to get started with). +- Enter your **Scaleway Secret Key**. + +These actions will edit automatically your config.json file. To edit it manually, see [Configure Continue through configuration file](#configure-continue-through-configuration-file). + +#### Configure Continue through configuration file + +To link Continue with Scaleway's Generative APIs, you can configure a settings file: - Create a `config.json` file inside your `.continue` directory. - Add the following configuration to enable Scaleway's Generative API: @@ -103,4 +117,4 @@ Refactoring is essential for maintaining clean and efficient code. Use the *"Con ## 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. \ No newline at end of file +By integrating Continue with Scaleway’s Generative APIs, you unlock AI-powered coding capabilities that enhance productivity, automate repetitive tasks, and improve code quality. From f0427227c848330f092cbad01f8c423032143957 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 12:39:33 +0100 Subject: [PATCH 02/11] Update adding-ai-to-vscode-using-continue.mdx --- .../adding-ai-to-vscode-using-continue.mdx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx index 048b71d4af..0f7e3deb11 100644 --- a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx +++ b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx @@ -40,7 +40,11 @@ To link Continue with Scaleway's Generative APIs, you can use built-in menus fro - Select the model you want to use (we recommend `Qwen 2.5 Coder 32b` to get started with). - Enter your **Scaleway Secret Key**. -These actions will edit automatically your config.json file. To edit it manually, see [Configure Continue through configuration file](#configure-continue-through-configuration-file). +These actions will edit automatically your `config.json file`. To edit it manually, see [Configure Continue through configuration file](#configure-continue-through-configuration-file). + + + Embeddings and autocomplete models are not yet supported through graphical interface configuration. To enable them, you need to edit configuration manually, see [Configure Continue through configuration file](#configure-continue-through-configuration-file). + #### Configure Continue through configuration file From badc356f4f40b868a700c290ed4f14aff7329a78 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:14:50 +0100 Subject: [PATCH 03/11] Update adding-ai-to-vscode-using-continue.mdx Add configuration details for specific project ids. --- .../adding-ai-to-vscode-using-continue.mdx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx index 0f7e3deb11..6366af6579 100644 --- a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx +++ b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx @@ -38,7 +38,7 @@ To link Continue with Scaleway's Generative APIs, you can use built-in menus fro - In the prompt section, click on **Select model** dropdown, then on **Add Chat model**. - Select **Scaleway** as provider. - Select the model you want to use (we recommend `Qwen 2.5 Coder 32b` to get started with). -- Enter your **Scaleway Secret Key**. +- Enter your **Scaleway Secret Key**. Note that to start with, we recommend you use a Scaleway Secret Key having access to your `default` Scaleway project. These actions will edit automatically your `config.json file`. To edit it manually, see [Configure Continue through configuration file](#configure-continue-through-configuration-file). @@ -61,7 +61,18 @@ To link Continue with Scaleway's Generative APIs, you can configure a settings f "provider": "scaleway", "apiKey": "###SCW_SECRET_KEY###" } - ] + ], + "embeddingsProvider": { + "model": "bge-multilingual-gemma2", + "provider": "scaleway", + "apiKey": "###SCW_SECRET_KEY###" + }, + "tabAutocompleteModel": { + "model": "qwen2.5-coder-32b", + "title": "Qwen2.5 Coder Autocomplete", + "provider": "scaleway", + "apiKey": "###SCW_SECRET_KEY###" + }, } ``` - Save the file at the correct location: @@ -70,6 +81,7 @@ To link Continue with Scaleway's Generative APIs, you can configure a settings f For more details on configuring `config.json`, refer to the [official Continue documentation](https://docs.continue.dev/reference). + If you want to limit access to a specific Scaleway Project, you should add the field `"apiBase": "https://api.scaleway.ai/###PROJECT_ID###/v1/"` for each model (ie. `models`, `embeddingsProvider` and `tabAutocompleteModel`) since the default url `https://api.scaleway.ai/v1/` can only be used with the `default` project. ### Activate Continue in VS Code From a88a4bb6ae800098a7bb48be94751f128ca56679 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:16:14 +0100 Subject: [PATCH 04/11] Update adding-ai-to-vscode-using-continue.mdx typo --- .../reference-content/adding-ai-to-vscode-using-continue.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx index 6366af6579..8457224e25 100644 --- a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx +++ b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx @@ -72,7 +72,7 @@ To link Continue with Scaleway's Generative APIs, you can configure a settings f "title": "Qwen2.5 Coder Autocomplete", "provider": "scaleway", "apiKey": "###SCW_SECRET_KEY###" - }, + } } ``` - Save the file at the correct location: From 7798a1c3e3463cfd84fb64fd910f90b7885f37da Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:17:22 +0100 Subject: [PATCH 05/11] Update adding-ai-to-vscode-using-continue.mdx --- .../reference-content/adding-ai-to-vscode-using-continue.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx index 8457224e25..44d5ac8fe4 100644 --- a/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx +++ b/pages/generative-apis/reference-content/adding-ai-to-vscode-using-continue.mdx @@ -110,7 +110,7 @@ Use the "Continue: Generate Code" command to generate boilerplate code, function ### 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. +Continue enhances your coding workflow with AI-driven code completion. Simply start typing, and the AI model will suggest code edition that you can accept by pressing `Tab`. ### Automated code refactoring From 3e3829a2936be0e4f1cd8459207b0a91dcb28cee Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:22:41 +0100 Subject: [PATCH 06/11] Update integrating-generative-apis-with-popular-tools.mdx --- ...ing-generative-apis-with-popular-tools.mdx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index 25ab4fe564..4a10ea1088 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -36,7 +36,7 @@ Scaleway Generative APIs follow OpenAI's API structure, making integration strai ### Configuration -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: +To use the OpenAI client library with Scaleway's Generative APIs, you'll need to set the API key and base URL in your OpenAI-compatible client: ```python import openai openai.api_key = "" @@ -51,9 +51,9 @@ print(response["choices"][0]["message"]["content"]) Make sure to replace `` with your actual API key. -### Using OpenAI for text generation +### Using OpenAI client for text generation -To use OpenAI for text generation, you can create a `ChatCompletion` object and call the `create` method: +To use OpenAI client for text generation, you can create a `ChatCompletion` object and call the `create` method: ```python response = openai.ChatCompletion.create( model="llama-3.1-8b-instruct", @@ -66,6 +66,11 @@ print(response["choices"][0]["message"]["content"]) LangChain is a popular library for building AI applications. Scaleway's Generative APIs support LangChain for both inference and embeddings. + + Refer our dedicated documentation for + - [Implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs](/tutorials/how-to-implement-rag-generativeapis/) + + ### Configuration To use LangChain with Scaleway's Generative APIs, you'll need to install the required dependencies: @@ -168,6 +173,12 @@ To use Continue Dev with Scaleway's Generative APIs, you'll need to modify the ` "provider": "scaleway", "model": "bge-multilingual-gemma2", "apiKey": "" + }, + "tabAutocompleteModel": { + "model": "qwen2.5-coder-32b", + "title": "Qwen2.5 Coder Autocomplete", + "provider": "scaleway", + "apiKey": "" } } ``` @@ -240,4 +251,4 @@ print(response.json()["choices"][0]["message"]["content"]) ``` Make sure to replace `` with your actual API key. - \ No newline at end of file + From e2535dd9099c8f1e522e538c0e2ad4052528ce43 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:46:28 +0100 Subject: [PATCH 07/11] Update integrating-generative-apis-with-popular-tools.mdx update OpenAI python library code examples --- ...ing-generative-apis-with-popular-tools.mdx | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index 4a10ea1088..1413fbafaa 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -36,16 +36,26 @@ Scaleway Generative APIs follow OpenAI's API structure, making integration strai ### Configuration -To use the OpenAI client library with Scaleway's Generative APIs, you'll need to set the API key and base URL in your OpenAI-compatible client: +To use the OpenAI client library with Scaleway's Generative APIs, you'll need to install the required dependencies: +```bash +pip install openai +``` + +Then you'll need to set the API key and base URL in your OpenAI-compatible client: ```python -import openai -openai.api_key = "" -openai.api_base = "https://api.scaleway.ai/v1" -response = openai.ChatCompletion.create( +from openai import OpenAI + +client = OpenAI( + base_url="https://api.scaleway.ai/v1", + api_key="" +) + +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"]) + +print(response.choices[0].message.content) ``` Make sure to replace `` with your actual API key. From e94455fcff35ba0ba6a4a3d63fd8fef67a0e0553 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 15:48:37 +0100 Subject: [PATCH 08/11] Update integrating-generative-apis-with-popular-tools.mdx Remove duplicated code --- ...ntegrating-generative-apis-with-popular-tools.mdx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index 1413fbafaa..158bb33a3f 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -44,18 +44,10 @@ pip install openai Then you'll need to set the API key and base URL in your OpenAI-compatible client: ```python from openai import OpenAI - client = OpenAI( base_url="https://api.scaleway.ai/v1", api_key="" ) - -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) ``` Make sure to replace `` with your actual API key. @@ -65,11 +57,11 @@ print(response.choices[0].message.content) To use OpenAI client for text generation, you can create a `ChatCompletion` object and call the `create` method: ```python -response = openai.ChatCompletion.create( +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"]) +print(response.choices[0].message.content) ``` ## LangChain (RAG & LLM applications) From c84be49c9444d5e8f7620ac70b6da9b1e30d10a5 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 18:43:53 +0100 Subject: [PATCH 09/11] Update integrating-generative-apis-with-popular-tools.mdx --- .../integrating-generative-apis-with-popular-tools.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index 158bb33a3f..f10ffba53e 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -55,7 +55,7 @@ client = OpenAI( ### Using OpenAI client for text generation -To use OpenAI client for text generation, you can create a `ChatCompletion` object and call the `create` method: +To use OpenAI client for text generation, you can create a `client.chat.completions` object and call the `create` method: ```python response = client.chat.completions.create( model="llama-3.1-8b-instruct", From c3f63f4ddb4934d7ab9ca6b3be4e1b2f942fdcdb Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 18:50:43 +0100 Subject: [PATCH 10/11] Update integrating-generative-apis-with-popular-tools.mdx --- ...tegrating-generative-apis-with-popular-tools.mdx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index f10ffba53e..55dd2fcc2b 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -24,7 +24,7 @@ The following table compares AI tools and libraries supported by Scaleway's Gene | [LlamaIndex](#llamaindex-document-indexing-and-retrieval) | Library for indexing and retrieving documents using AI models | Document indexing and retrieval, question answering | Medium | | [Continue Dev](#continue-dev-ai-coding-assistance) | Library for AI-powered coding assistance | Code completion, code review | Low | | [Transformers (Hugging Face)](#transformers-hugging-face-integration) | Library for pre-trained models for natural language processing | Text generation, language translation, text summarization | Medium | -| [cURL/Python](#api-clients-and-custom-integrations) | Direct API clients for custom integrations | Custom applications, data processing | High | +| [cURL/Python](#custom-http-integrations) | Direct HTTP API calls for custom integrations | Custom applications, data processing | High | The integration effort is subjective and may vary depending on the specific use case and requirements. @@ -215,7 +215,7 @@ To use Hugging Face for text generation, you can call the `generator` function: ```python print(generator("Write a short poem about the ocean")) ``` -## API clients and custom integrations +## Custom HTTP integrations You can interact with Scaleway's Generative APIs directly using any HTTP client. @@ -235,9 +235,14 @@ curl https://api.scaleway.ai/v1/chat/completions \ Make sure to replace `` with your actual API key. -### Python example +### Python HTTP example -To use Python with Scaleway's Generative APIs, you can use the following code: +To perform HTTP requests with Scaleway's Generative APIs, you'll need to install `requests` dependency: +```bash +pip install requests +``` + +Then, you can use the following code: ```python import requests headers = { From 36f9245944b39c1378c0f47acb90e2d4d06a5381 Mon Sep 17 00:00:00 2001 From: fpagny Date: Fri, 21 Feb 2025 18:53:41 +0100 Subject: [PATCH 11/11] Update integrating-generative-apis-with-popular-tools.mdx --- .../integrating-generative-apis-with-popular-tools.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx index 55dd2fcc2b..ad2bbb1758 100644 --- a/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx +++ b/pages/generative-apis/reference-content/integrating-generative-apis-with-popular-tools.mdx @@ -19,7 +19,7 @@ The following table compares AI tools and libraries supported by Scaleway's Gene | Tool/Library | Description | Use cases | Integration effort | | --- | --- | --- | --- | -| [OpenAI](#openai-compatible-libraries) | Popular AI library for natural language processing | Text generation, language translation, text summarization | Low | +| [OpenAI client](#openai-client-libraries) | Popular AI library for natural language processing | Text generation, language translation, text summarization | Low | | [LangChain](#langchain-rag-and-llm-applications) | Library for building AI applications | Inference, embeddings, document indexing and retrieval | Medium | | [LlamaIndex](#llamaindex-document-indexing-and-retrieval) | Library for indexing and retrieving documents using AI models | Document indexing and retrieval, question answering | Medium | | [Continue Dev](#continue-dev-ai-coding-assistance) | Library for AI-powered coding assistance | Code completion, code review | Low | @@ -30,7 +30,7 @@ The following table compares AI tools and libraries supported by Scaleway's Gene The integration effort is subjective and may vary depending on the specific use case and requirements. -## OpenAI-compatible libraries +## OpenAI client libraries 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.