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
4. Use the `llm` object and the `tools` list to generate a response to your query with the following code:
110
+
```python
111
+
query ="What is 3 * 12?"
112
+
# You can also try the following query:
113
+
# query = "What is 42 + 4?"
114
+
115
+
messages = [HumanMessage(query)] # We initialize the messages list with the user's query.
116
+
117
+
ai_msg = llm_with_tools.invoke(messages) # We generate a response to the query.
118
+
messages.append(ai_msg) # We append the response to the messages list.
119
+
120
+
for tool_call in ai_msg.tool_calls:
121
+
selected_tool = {"add": add, "multiply": multiply}[tool_call["name"].lower()] # Depending on the tool name, we select the appropriate tool.
122
+
tool_msg = selected_tool.invoke(tool_call) # We invoke the selected tool with the tool call.
123
+
messages.append(tool_msg) # We append the tool's response to the messages list.
124
+
125
+
print(llm_with_tools.invoke(messages).content) # We print the content of the final response.
126
+
```
127
+
5. Run `tools.py`:
128
+
```bash
129
+
$ python tools.py
130
+
The result of 3 * 12 is 36.
131
+
```
132
+
74
133
<Messagetype="tip">
75
134
Refer to our dedicated documentation for [implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs](/tutorials/how-to-implement-rag-generativeapis/)
76
135
</Message>
77
136
78
137
## LlamaIndex (advanced RAG applications)
79
138
80
-
LlamaIndex is an open-source framework for building Large Language Models (LLMs) based applications, especially optimizing RAG (Retrieval Augmented Generation) pipelines.
139
+
LlamaIndex is an open-source framework for building Large Language Models (LLMs) based applications, especially optimizing RAG (Retrieval Augmented Generation) pipelines.
81
140
1. Install the required dependencies to use the LlamaIndex framework with Scaleway's Generative APIs:
82
141
```bash
83
142
pip install llama-index-llms-openai-like
@@ -197,7 +256,7 @@ Chatbox AI is a powerful AI client and smart assistant, compatible with Scaleway
197
256
198
257
## Bolt.diy (code generation)
199
258
200
-
Bolt.diy is a software enabling users to create web applications from the prompt.
259
+
Bolt.diy is a software enabling users to create web applications from the prompt.
201
260
202
261
1. Install and launch Bolt.diy locally. Follow the setup instructions provided in the [Bolt.diy GitHub repository](https://github.com/stackblitz-labs/bolt.diy?tab=readme-ov-file#setup).
203
262
2. Once Bolt.diy is running, open the interface in your web browser.
@@ -206,9 +265,13 @@ Bolt.diy is a software enabling users to create web applications from the prompt
206
265
5. Click **Local Providers** to add a new external provider configuration.
207
266
6. Toggle the switch next to **OpenAILike** to enable it. Then, enter the Scaleway API endpoint: `https://api.scaleway.ai/v1` as the base URL.
208
267
7. In Bolt's main menu, select`OpenAILike` and input your **Scaleway Secret Key** as the `OpenAILike API Key`.
209
-
8. Select one of the supported models from Scaleway Generative APIs. For best results with Bolt.diy, which requires a significant amount of output tokens (8000 by default), start with the `llama-3.1-8b-instruct` model.
268
+
8. Select one of the supported models from Scaleway Generative APIs. For best results with Bolt.diy, which requires a significant amount of output tokens (8000 by default), start with the `gemma-3-27b-it` model.
210
269
9. Enter your prompt in the Bolt.diy interface to see your application being generated.
211
270
271
+
<Message type="important">
272
+
Only models that have a maximum output token of at least 8000 tokens are supported. Refer to the [list of Generative APIs models](/generative-apis/reference-content/supported-models/#chat-models) for more information.
273
+
</Message>
274
+
212
275
Alternatively, you can also setup your Scaleway Secret Key by renaming `.env.example` to `.env`, adding corresponding environment variables values and restarting Bolt.diy:
0 commit comments