Chroma Vector Store: replace RestTemplate by RestClient
- replace RestTemplate by RestClient but default to SimpleClientHttpRequestFactory as Chroma seems to have issues with HTTP2. - update the documentation. - update the ghcr.io/chroma-core/chroma version to 0.5.0. Fix the withBasicAuthCredentials. Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
This commit is contained in:
committed by
Christian Tzolov
parent
46e47849ce
commit
704dec20d9
@@ -205,19 +205,20 @@ TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Man
|
||||
|
||||
=== Sample Code
|
||||
|
||||
Create a `RestTemplate` instance with proper ChromaDB authorization configurations and Use it to create a `ChromaApi` instance:
|
||||
Create a `RestClient.Builder` instance with proper ChromaDB authorization configurations and Use it to create a `ChromaApi` instance:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
public RestClient.Builder builder() {
|
||||
return RestClient.builder().requestFactory(new SimpleClientHttpRequestFactory());
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public ChromaApi chromaApi(RestTemplate restTemplate) {
|
||||
public ChromaApi chromaApi(RestClient.Builder restClientBuilder) {
|
||||
String chromaUrl = "http://localhost:8000";
|
||||
ChromaApi chromaApi = new ChromaApi(chromaUrl, restTemplate);
|
||||
ChromaApi chromaApi = new ChromaApi(chromaUrl, restClientBuilder);
|
||||
return chromaApi;
|
||||
}
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user