{
  "name": "forge.embed",
  "language": "python",
  "version": "0.1.0",
  "description": "Python embed package; imports are explicit from this package.",
  "manifest": "forge-py/pyproject.toml",
  "manifestSha256": "7f96957378b21995bf2e583af2afd1b9e6fb3b0089ff3559d62c7e012a034696",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/python/embed",
  "features": {},
  "files": [
    {
      "path": "forge-py/src/forge/embed/__init__.py",
      "sha256": "35798c44845fca00ac378e847197c43eff1fdd9c450621b83fc0ed93cee22531",
      "artifactSha256": "0c63075cbfe447859bbb38e42e89e9e1c126bba14ba6e4e8b96fcbc8789c9c3b",
      "url": "/reference/source/forge-py/src/forge/embed/__init__.py.txt",
      "declarations": []
    },
    {
      "path": "forge-py/src/forge/embed/chunking.py",
      "sha256": "2d96def3f76fca9e1809f511f6be5dd6337a3914121d29d05a47425aa353c422",
      "artifactSha256": "b37790fe44ada4160e0e91f200350ff34e8457b7e643900b03d6aa5db2edb65e",
      "url": "/reference/source/forge-py/src/forge/embed/chunking.py.txt",
      "declarations": [
        {
          "name": "Chunk",
          "line": 9,
          "signature": "class Chunk()",
          "documentation": "A chunk of text extracted from a document.\n\nArgs:\n    text: The chunk text content.\n    start: Starting character offset in the original text.\n    end: Ending character offset in the original text.\n    index: The chunk index (0-based)."
        },
        {
          "name": "TextChunker",
          "line": 25,
          "signature": "class TextChunker()",
          "documentation": "Configurable text chunker for splitting documents.\n\nArgs:\n    chunk_size: Target size of each chunk in characters.\n    overlap: Number of overlapping characters between consecutive chunks.\n\nExample:\n    >>> chunker = TextChunker(chunk_size=100, overlap=20)\n    >>> chunks = chunker.chunk(\"Hello world. \" * 20)\n    >>> len(chunks) > 1\n    True"
        },
        {
          "name": "TextChunker.__init__",
          "line": 39,
          "signature": "def __init__(self, chunk_size: int=1000, overlap: int=200) -> None",
          "documentation": ""
        },
        {
          "name": "TextChunker.chunk",
          "line": 52,
          "signature": "def chunk(self, text: str) -> list[Chunk]",
          "documentation": "Split text into overlapping chunks.\n\nArgs:\n    text: The text to chunk.\n\nReturns:\n    List of Chunk instances."
        },
        {
          "name": "chunk_text",
          "line": 80,
          "signature": "def chunk_text(text: str, chunk_size: int=1000, overlap: int=200) -> list[Chunk]",
          "documentation": "Convenience function for splitting text into chunks.\n\nArgs:\n    text: The text to chunk.\n    chunk_size: Target chunk size in characters.\n    overlap: Overlap between consecutive chunks.\n\nReturns:\n    List of Chunk instances."
        }
      ]
    },
    {
      "path": "forge-py/src/forge/embed/provider.py",
      "sha256": "4037be6fc9a2531a3ab89c44c4cffc4f23518b42d747e8f72284307a02580485",
      "artifactSha256": "f15e6ca937ad015bc7173fd5c3af11e2e02721073720287952d4520e95133e6b",
      "url": "/reference/source/forge-py/src/forge/embed/provider.py.txt",
      "declarations": [
        {
          "name": "EmbeddingResult",
          "line": 12,
          "signature": "class EmbeddingResult()",
          "documentation": "Result of an embedding operation.\n\nArgs:\n    embeddings: List of embedding vectors (each a list of floats).\n    model: The model used for embedding.\n    usage_tokens: Total tokens consumed."
        },
        {
          "name": "EmbeddingProvider",
          "line": 26,
          "signature": "class EmbeddingProvider(ABC)",
          "documentation": "Abstract base class for embedding providers.\n\nImplementations generate vector embeddings from text inputs."
        },
        {
          "name": "EmbeddingProvider.provider_name",
          "line": 34,
          "signature": "def provider_name(self) -> str",
          "documentation": "Return the provider name.\n\nReturns:\n    The provider name string."
        },
        {
          "name": "EmbeddingProvider.embed",
          "line": 42,
          "signature": "async def embed(self, texts: list[str], options: EmbedOptions | None=None) -> EmbeddingResult",
          "documentation": "Generate embeddings for the given texts.\n\nArgs:\n    texts: List of text strings to embed.\n    options: Optional embedding options.\n\nReturns:\n    The embedding result."
        },
        {
          "name": "EmbeddingProvider.embed_single",
          "line": 57,
          "signature": "async def embed_single(self, text: str, options: EmbedOptions | None=None) -> tuple[float, ...]",
          "documentation": "Generate an embedding for a single text.\n\nArgs:\n    text: The text to embed.\n    options: Optional embedding options.\n\nReturns:\n    The embedding vector."
        }
      ]
    },
    {
      "path": "forge-py/src/forge/embed/similarity.py",
      "sha256": "a043c0f6b4d040cf3556dc571433aee31d54039c7fa4430106a16a40e7894c9d",
      "artifactSha256": "a1530f7de1ad478d14f43f53f661989ee61bb88a079eacd4de9b4d67495c4e0a",
      "url": "/reference/source/forge-py/src/forge/embed/similarity.py.txt",
      "declarations": [
        {
          "name": "cosine_similarity",
          "line": 8,
          "signature": "def cosine_similarity(a: tuple[float, ...], b: tuple[float, ...]) -> float",
          "documentation": "Compute the cosine similarity between two vectors.\n\nArgs:\n    a: First vector.\n    b: Second vector.\n\nReturns:\n    Cosine similarity in range [-1.0, 1.0].\n\nRaises:\n    ValueError: If vectors have different lengths or are zero-length.\n\nExample:\n    >>> cosine_similarity((1.0, 0.0), (1.0, 0.0))\n    1.0\n    >>> abs(cosine_similarity((1.0, 0.0), (0.0, 1.0))) < 1e-10\n    True"
        },
        {
          "name": "dot_product",
          "line": 44,
          "signature": "def dot_product(a: tuple[float, ...], b: tuple[float, ...]) -> float",
          "documentation": "Compute the dot product of two vectors.\n\nArgs:\n    a: First vector.\n    b: Second vector.\n\nReturns:\n    The dot product.\n\nRaises:\n    ValueError: If vectors have different lengths.\n\nExample:\n    >>> dot_product((1.0, 2.0, 3.0), (4.0, 5.0, 6.0))\n    32.0"
        },
        {
          "name": "euclidean_distance",
          "line": 67,
          "signature": "def euclidean_distance(a: tuple[float, ...], b: tuple[float, ...]) -> float",
          "documentation": "Compute the Euclidean distance between two vectors.\n\nArgs:\n    a: First vector.\n    b: Second vector.\n\nReturns:\n    The Euclidean distance (always non-negative).\n\nRaises:\n    ValueError: If vectors have different lengths.\n\nExample:\n    >>> euclidean_distance((0.0, 0.0), (3.0, 4.0))\n    5.0"
        }
      ]
    },
    {
      "path": "forge-py/src/forge/embed/vector_store.py",
      "sha256": "1db031e2dfca0238b3fb90fd5b385df20b1d8819b3357064935a97cc4bcec0e7",
      "artifactSha256": "bec0fa1ff9c6d8c1acdd911b5b06ec6618e8ff7bcc43c1793dbfb35b652ea738",
      "url": "/reference/source/forge-py/src/forge/embed/vector_store.py.txt",
      "declarations": [
        {
          "name": "SearchResult",
          "line": 12,
          "signature": "class SearchResult()",
          "documentation": "A search result from the vector store.\n\nArgs:\n    id: The document identifier.\n    score: The similarity score.\n    metadata: Optional metadata associated with the document."
        },
        {
          "name": "VectorStore",
          "line": 26,
          "signature": "class VectorStore()",
          "documentation": "In-memory vector store for RAG applications.\n\nStores document embeddings and supports similarity search.\nUses cosine similarity by default.\n\nExample:\n    >>> store = VectorStore()\n    >>> store.add(\"doc1\", (0.1, 0.2, 0.3))\n    >>> results = store.search((0.1, 0.2, 0.3), top_k=1)\n    >>> results[0].id\n    'doc1'"
        },
        {
          "name": "VectorStore.__init__",
          "line": 40,
          "signature": "def __init__(self) -> None",
          "documentation": ""
        },
        {
          "name": "VectorStore.add",
          "line": 44,
          "signature": "def add(self, doc_id: str, embedding: tuple[float, ...], metadata: dict[str, Any] | None=None) -> None",
          "documentation": "Add a document embedding to the store.\n\nArgs:\n    doc_id: Unique document identifier.\n    embedding: The embedding vector.\n    metadata: Optional metadata dictionary."
        },
        {
          "name": "VectorStore.search",
          "line": 60,
          "signature": "def search(self, query: tuple[float, ...], top_k: int=10) -> list[SearchResult]",
          "documentation": "Search for the most similar documents.\n\nArgs:\n    query: The query embedding vector.\n    top_k: Maximum number of results to return.\n\nReturns:\n    List of SearchResult sorted by descending similarity score."
        },
        {
          "name": "VectorStore.remove",
          "line": 88,
          "signature": "def remove(self, doc_id: str) -> bool",
          "documentation": "Remove a document from the store.\n\nArgs:\n    doc_id: The document identifier.\n\nReturns:\n    True if the document was found and removed."
        }
      ]
    }
  ]
}
