mirror of
https://github.com/ollama/ollama.git
synced 2025-11-11 05:17:42 +01:00
allowed base64 encoding
This commit is contained in:
@@ -383,11 +383,15 @@ func ToListCompletion(r api.ListResponse) ListCompletion {
|
||||
// encodingFormat can be "float", "base64", or empty (defaults to "float")
|
||||
func ToEmbeddingList(model string, r api.EmbedResponse, encodingFormat string) EmbeddingList {
|
||||
if r.Embeddings != nil {
|
||||
if encodingFormat == "" {
|
||||
encodingFormat = "float"
|
||||
}
|
||||
|
||||
var data []Embedding
|
||||
for i, e := range r.Embeddings {
|
||||
var embedding any
|
||||
if strings.EqualFold(encodingFormat, "base64") {
|
||||
embedding = floatsToBase64(e)
|
||||
if encodingFormat == "base64" {
|
||||
embedding = convertFloatsToBase64(e)
|
||||
} else {
|
||||
embedding = e
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user