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
Use Vector Stores with any LiteLLM supported model
13
+
</p>
14
+
2
15
3
-
LiteLLM integrates with AWS Bedrock Knowledge Bases, allowing your models to access your organization's data for more accurate and contextually relevant responses.
16
+
LiteLLM integrates with vector stores, allowing your models to access your organization's data for more accurate and contextually relevant responses.
In order to use a Bedrock Knowledge Base with LiteLLM, you need to pass `vector_store_ids` as a parameter to the completion request. Where `vector_store_ids` is a list of Bedrock Knowledge Base IDs.
23
+
In order to use a vector store with LiteLLM, you need to
24
+
25
+
- Initialize litellm.vector_store_registry
26
+
- Pass tools with vector_store_ids to the completion request. Where `vector_store_ids` is a list of vector store ids you initialized in litellm.vector_store_registry
8
27
9
28
### LiteLLM Python SDK
10
29
30
+
LiteLLM's allows you to use vector stores in the [OpenAI API spec](https://platform.openai.com/docs/api-reference/chat/create) by passing a tool with vector_store_ids you want to use
31
+
11
32
```python showLineNumbers title="Basic Bedrock Knowledge Base Usage"
12
33
import os
13
34
import litellm
14
35
36
+
from litellm.vector_stores.vector_store_registry import VectorStoreRegistry, LiteLLM_ManagedVectorStore
In order to use a vector store with LiteLLM, you need to configure your vector_store_registry. This tells litellm which vector stores to use and api provider to use for the vector store.
vector_store_description: "Bedrock vector store for the Litellm website knowledgebase"
86
+
vector_store_metadata:
87
+
source: "https://www.litellm.com/docs"
88
+
37
89
```
38
90
39
-
#### 2. Make a request with vector_store_ids parameter
91
+
</TabItem>
92
+
93
+
<TabItemvalue="litellm-ui"label="LiteLLM UI">
94
+
95
+
On the LiteLLM UI, Navigate to Experimental > Vector Stores > Create Vector Store. On this page you can create a vector store with a name, vector store id and credentials.
96
+
<Image
97
+
img={require('../../img/kb_2.png')}
98
+
style={{width: '50%'}}
99
+
/>
100
+
101
+
40
102
41
-
import Tabs from '@theme/Tabs';
42
-
import TabItem from '@theme/TabItem';
103
+
104
+
</TabItem>
105
+
106
+
</Tabs>
107
+
108
+
#### 2. Make a request with vector_store_ids parameter
LiteLLM allows you to view your vector store usage in the LiteLLM UI on the `Logs` page.
168
+
169
+
After completing a request with a vector store, navigate to the `Logs` page on LiteLLM. Here you should be able to see the query sent to the vector store and corresponding response with scores.
170
+
171
+
<Image
172
+
img={require('../../img/kb_4.png')}
173
+
style={{width: '80%'}}
174
+
/>
175
+
<pstyle={{textAlign:'left',color:'#666'}}>
176
+
LiteLLM Logs Page: Vector Store Usage
177
+
</p>
178
+
179
+
180
+
### Listing available vector stores
181
+
182
+
You can list all available vector stores using the /vector_store/list endpoint
183
+
184
+
**Request:**
185
+
```bash showLineNumbers title="List all available vector stores"
186
+
curl -X GET "http://localhost:4000/vector_store/list" \
187
+
-H "Authorization: Bearer $LITELLM_API_KEY"
188
+
```
189
+
190
+
**Response:**
191
+
192
+
The response will be a list of all vector stores that are available to use with LiteLLM.
"vector_store_description": "Bedrock vector store for the Litellm website knowledgebase",
203
+
"vector_store_metadata": {
204
+
"source": "https://www.litellm.com/docs"
205
+
},
206
+
"created_at": "2023-05-03T18:21:36.462Z",
207
+
"updated_at": "2023-05-03T18:21:36.462Z",
208
+
"litellm_credential_name": "bedrock_credentials"
209
+
}
210
+
],
211
+
"total_count": 1,
212
+
"current_page": 1,
213
+
"total_pages": 1
214
+
}
215
+
```
216
+
217
+
218
+
### Always on for a model
219
+
220
+
**Use this if you want vector stores to be used by default for a specific model.**
221
+
222
+
In this config, we add `vector_store_ids` to the claude-3-5-sonnet-with-vector-store model. This means that any request to the claude-3-5-sonnet-with-vector-store model will always use the vector store with the id `T37J8R4WTM` defined in the `vector_store_registry`.
223
+
224
+
```yaml showLineNumbers title="Always on for a model"
0 commit comments