Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ The following table compares AI tools and libraries supported by Scaleway's Gene
| Tool/Library | Description | Use cases | Integration effort |
| --- | --- | --- | --- |
| [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-data-framework) | Framework for building powerful LLM (Large Language Model) applications | Knowledge graph building, document retrieval, data indexing | Medium |
| [LangChain](#langchain-rag-and-llm-applications) | Library for building AI applications leveraging RAG | Inference, embeddings, document indexing and retrieval | Medium |
| [LlamaIndex](#llamaIndex-advanced-rag-applications) | Library for building advanced AI RAG applications | Knowledge graph building, document retrieval, data indexing | Medium |
| [Continue Dev](#continue-dev-ai-coding-assistance) | Library for AI-powered coding assistance | Code completion, code review | Low |
| [cURL/Python](#custom-http-integrations) | Direct HTTP API calls for custom integrations | Custom applications, data processing | High |

Expand Down Expand Up @@ -72,46 +72,47 @@ LangChain is a popular library for building AI applications. Scaleway's Generati
- [Implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs](/tutorials/how-to-implement-rag-generativeapis/)
</Message>

## LlamaIndex data framework

LlamaIndex is an open source is a data framework for building Large Language Models (LLMs) based application. To get started, you'll need to install the LlamaIndex and set up your API key.

### Configuration
## LlamaIndex (advanced RAG applications)

LlamaIndex is an open source framework for building Large Language Models (LLMs) based application, especially optimizing RAG (Retrieval Augmented Generation) pipelines.
To use the LlamaIndex framework with Scaleway's Generative APIs, first install the required dependencies:

```bash
pip install llama-index-llms-openai-like
pip install llama-index-llms-openai-like
```

Then set the API key and base URL in your OpenAILike-compatible client:

Then, create a file `main.py` and add the following code to it to configure `OpenAILike` client and secret key:
```python
from llama_index.llms.openai_like import OpenAILike
from llama_index.core.llms import ChatMessage

llm = OpenAILike(
model="pixtral-12b-2409",
api_key="<API secret key>",
api_base="https://api.scaleway.ai/v1",
max_tokens=512,
temperature=0.7,
top_p=1,
presence_penalty=0,
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,
)
```
<Message type="tip">
Make sure to replace `<API secret key>` with your actual API key.
</Message>

### Using LlamaIndex client to chat with the LLM

Once the configuration is set up, you can interact with the LLM by sending messages to the model. The following code demonstrates how to chat with the model using LlamaIndex:

You can then interact with the LLM by sending messages to the model with the following code:
```python
response = llm.chat([ChatMessage("could you tell about Scaleway please")])
print(response)
response = llm.chat([ChatMessage("Could you tell me about Scaleway please ?")])
print(response)
```

Finally, run `main.py`:
```python
python main.py
```
The LLM response should display an answer:
```bash
Generally, Scaleway is a reliable and secure cloud provider that offers a range of services for businesses and developers.
```

## Continue Dev (AI coding assistance)

Expand Down Expand Up @@ -166,4 +167,4 @@ print(response.json()["choices"][0]["message"]["content"])
```
<Message type="tip">
Make sure to replace `<API secret key>` with your actual API key.
</Message>
</Message>