Skip to content

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Sep 2, 2025

Impact

This PR enhances data privacy for embedding operations and brings consistency across all embedding instrumentation providers, including BeeAI and Haystack.

Key Features

🔒 Privacy Controls for Embeddings

  • New configuration options to protect sensitive embedding data:
    • OPENINFERENCE_HIDE_EMBEDDINGS_VECTORS: Redacts embedding vectors with "__REDACTED__"
    • OPENINFERENCE_HIDE_EMBEDDINGS_TEXT: Redacts embedding text content
  • Consistent redaction behavior across all instrumentation packages

🎯 Standardized Embedding Instrumentation

All providers now use:

  • Consistent span name: "CreateEmbeddings"
  • Standardized attribute structure: embedding.embeddings.N.embedding.{text|vector}
  • Unified invocation parameter tracking: embedding.invocation_parameters
  • Proper llm.system attribute for provider identification

Provider-specific improvements:

BeeAI:

  • Added embedding.invocation_parameters extraction from input events
  • Ensured embedding vectors are always lists (not tuples)
  • Added proper llm.system: "beeai" identification
  • Removed unnecessary child spans for cleaner traces

Haystack:

  • Added dynamic llm.system based on component class name
  • Improved embedding vector decoding (supports base64 and raw arrays)
  • Added invocation parameter extraction (excludes input data)
  • Enhanced numpy array compatibility

OpenAI/LiteLLM:

  • Full batch embedding support with indexed attributes
  • Separated invocation parameters from input data
  • Improved handling of token IDs vs text inputs

📋 Specification Alignment

  • Updated spec to clarify when text attributes are populated (only for string inputs, not token IDs)
  • Documented why token IDs aren't decoded (cross-provider incompatibility, runtime constraints)
  • Clarified redaction behavior for each configuration option

@codefromthecrypt codefromthecrypt requested a review from a team as a code owner September 2, 2025 01:53
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Sep 2, 2025
@codefromthecrypt codefromthecrypt marked this pull request as draft September 2, 2025 01:55
cursor[bot]

This comment was marked as outdated.

@codefromthecrypt
Copy link
Contributor Author

I will pull out of draft once I unbreak the build

@codefromthecrypt codefromthecrypt force-pushed the spec-embeddings branch 4 times, most recently from 7c023fa to 5a25a52 Compare September 10, 2025 01:34
@codefromthecrypt codefromthecrypt marked this pull request as ready for review September 14, 2025 06:54
@codefromthecrypt
Copy link
Contributor Author

codefromthecrypt commented Sep 14, 2025

@mikeldking this should be ready to review because the code that does embedding is up to date. There are a couple red packages unrelated to this change and need some work to get green.

Agno: It essentially doesn't function because it's only partially ported to version 2.0. We need to bump the minimum version requirement to 2.0, as 1.5 is no longer compatible. Additionally, the tests aren't correct because they are only catching the LLM spans not the http requests made by the agent. This results in inconsistent runs.If you'd like, I can share my partially completed branch, but I won't be able to dedicate time to iterating on it further.

smolagents : Fixing the mypy errors in smolagents might require less effort overall.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt
Copy link
Contributor Author

cursor[bot]

This comment was marked as outdated.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt
Copy link
Contributor Author

added the smolagents fix. crewai is new but I can't reproduce that locally. agno is the biggie, but not related to this change either

"pytest-recording",
"openai",
"ddgs",
"duckduckgo-search",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this to be ddgs as it got renamed for agno

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool.

@codefromthecrypt
Copy link
Contributor Author

FYI I plan to break apart this PR into pieces, to make it easier to review. so any comments here I'll carry over to the partitioned PRs and mark this draft until only the spec/substrate remains.

@codefromthecrypt codefromthecrypt marked this pull request as draft September 18, 2025 01:21
@codefromthecrypt
Copy link
Contributor Author

part 1: openai #2210

once in I'll do the same changes for litellm and pull both off this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants