mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
refactor(vector): improve ollama support
This commit is contained in:
parent
386ca86297
commit
29e3b47017
@ -47,10 +47,10 @@ impl Embedder {
|
|||||||
url: options.url.unwrap_or_else(get_ollama_path),
|
url: options.url.unwrap_or_else(get_ollama_path),
|
||||||
request: serde_json::json!({
|
request: serde_json::json!({
|
||||||
"model": model,
|
"model": model,
|
||||||
"prompt": super::rest::REQUEST_PLACEHOLDER,
|
"input": super::rest::REQUEST_PLACEHOLDER,
|
||||||
}),
|
}),
|
||||||
response: serde_json::json!({
|
response: serde_json::json!({
|
||||||
"embedding": super::rest::RESPONSE_PLACEHOLDER,
|
"embeddings": super::rest::RESPONSE_PLACEHOLDER,
|
||||||
}),
|
}),
|
||||||
headers: Default::default(),
|
headers: Default::default(),
|
||||||
},
|
},
|
||||||
@ -118,6 +118,6 @@ impl Embedder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_ollama_path() -> String {
|
fn get_ollama_path() -> String {
|
||||||
// Important: Hostname not enough, has to be entire path to embeddings endpoint
|
// Important: Hostname not enough, has to be entire path to embeddings endpoint (endpoint can be found in the API documentation: https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings)
|
||||||
std::env::var("MEILI_OLLAMA_URL").unwrap_or("http://localhost:11434/api/embeddings".to_string())
|
std::env::var("MEILI_OLLAMA_URL").unwrap_or("http://localhost:11434/api/embed".to_string())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user