Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
henomis committed May 14, 2024
1 parent 5bfea7d commit 0d2e58c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions embedder/huggingface/huggingface.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ func (h *HuggingFaceEmbedder) WithModel(model string) *HuggingFaceEmbedder {
return h
}

func (h *HuggingFaceEmbedder) WithObserver(observer embobserver.EmbeddingObserver, traceID string) *HuggingFaceEmbedder {
func (h *HuggingFaceEmbedder) WithObserver(
observer embobserver.EmbeddingObserver,
traceID string,
) *HuggingFaceEmbedder {
h.observer = observer
h.observerTraceID = traceID
return h
Expand All @@ -65,7 +68,7 @@ func (h *HuggingFaceEmbedder) Embed(ctx context.Context, texts []string) ([]embe
observerEmbedding, err = embobserver.StartObserveEmbedding(
h.observer,
h.name,
string(h.model),
h.model,
nil,
h.observerTraceID,
observer.ContextValueParentID(ctx),
Expand Down
8 changes: 4 additions & 4 deletions embedder/ollama/ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (e *Embedder) Embed(ctx context.Context, texts []string) ([]embedder.Embedd
observerEmbedding, err = embobserver.StartObserveEmbedding(
e.observer,
e.name,
string(e.model),
e.model,
nil,
e.observerTraceID,
observer.ContextValueParentID(ctx),
Expand All @@ -69,9 +69,9 @@ func (e *Embedder) Embed(ctx context.Context, texts []string) ([]embedder.Embedd

embeddings := make([]embedder.Embedding, len(texts))
for i, text := range texts {
embedding, err := e.embed(ctx, text)
if err != nil {
return nil, err
embedding, errEmbedd := e.embed(ctx, text)
if errEmbedd != nil {
return nil, errEmbedd
}
embeddings[i] = embedding
}
Expand Down
2 changes: 1 addition & 1 deletion embedder/voyage/voyage.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (e *Embedder) Embed(ctx context.Context, texts []string) ([]embedder.Embedd
observerEmbedding, err = embobserver.StartObserveEmbedding(
e.observer,
e.name,
string(e.model),
e.model,
nil,
e.observerTraceID,
observer.ContextValueParentID(ctx),
Expand Down

0 comments on commit 0d2e58c

Please sign in to comment.