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
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
94
+
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
95
+
System.out.println(qr);
96
+
} catch (Exception e) {
97
+
System.out.println(e);
98
+
}
99
+
}
100
+
}
101
+
```
102
+
62
103
### Example OpenAI Embedding Function
63
104
64
105
In this example we rely on `tech.amikos.chromadb.OpenAIEmbeddingFunction` to generate embeddings for our documents.
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
163
-
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
205
+
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
206
+
System.out.println(qr);
207
+
} catch (Exception e) {
208
+
e.printStackTrace();
209
+
System.out.println(e);
210
+
}
168
211
}
169
-
}
170
212
}
171
213
```
172
214
@@ -176,8 +218,6 @@ The above should output:
176
218
{"documents":[["Hello, my name is Bond. I am a Spy.","Hello, my name is John. I am a Data Scientist."]],"ids":[["2","1"]],"metadatas":[[{"type":"spy"},{"type":"scientist"}]],"distances":[[5112.614,10974.804]]}
177
219
```
178
220
179
-
180
-
181
221
### Example Hugging Face Sentence Transformers Embedding Function
182
222
183
223
In this example we rely on `tech.amikos.chromadb.HuggingFaceEmbeddingFunction` to generate embeddings for our documents.
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
211
-
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
251
+
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
252
+
System.out.println(qr);
253
+
} catch (Exception e) {
254
+
System.out.println(e);
255
+
}
215
256
}
216
-
}
217
257
}
218
258
```
219
259
@@ -223,6 +263,44 @@ The above should output:
223
263
{"documents":[["Hello, my name is Bond. I am a Spy.","Hello, my name is John. I am a Data Scientist."]],"ids":[["2","1"]],"metadatas":[[{"type":"spy"},{"type":"scientist"}]],"distances":[[0.9073759,1.6440368]]}
224
264
```
225
265
266
+
### Ollama Embedding Function
267
+
268
+
In this example we rely on `tech.amikos.chromadb.embeddings.ollama.OllamaEmbeddingFunction` to generate embeddings for
collection.add(null, metadata, Arrays.asList("Hello, my name is John. I am a Data Scientist.", "Hello, my name is Bond. I am a Spy."), Arrays.asList("1", "2"));
295
+
Collection.QueryResponse qr = collection.query(Arrays.asList("Who is the spy"), 10, null, null, null);
296
+
System.out.println(qr);
297
+
} catch (Exception e) {
298
+
System.out.println(e);
299
+
}
300
+
}
301
+
}
302
+
```
303
+
226
304
### Example Auth
227
305
228
306
> Note: This is a workaround until the client overhaul is completed
0 commit comments