MCPcopy Create free account
hub / github.com/cloudwego/eino / WithSparseVector

Method WithSparseVector

schema/document.go:197–205  ·  view source on GitHub ↗

WithSparseVector sets the sparse vector of the document, key indices -> value vector. can use doc.SparseVector() to get the sparse vector.

(sparse map[int]float64)

Source from the content-addressed store, hash-verified

195// WithSparseVector sets the sparse vector of the document, key indices -> value vector.
196// can use doc.SparseVector() to get the sparse vector.
197func (d *Document) WithSparseVector(sparse map[int]float64) *Document {
198 if d.MetaData == nil {
199 d.MetaData = make(map[string]any)
200 }
201
202 d.MetaData[docMetaDataKeySparseVector] = sparse
203
204 return d
205}
206
207// SparseVector returns the sparse vector of the document, key indices -> value vector.
208// can use doc.WithSparseVector() to set the sparse vector.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected