[Embedding] generate from text

The Embedding generate from text operation create numeric vectors from a text (without ingestion into the vector database).

Embedding Generate from Text

Input Fields

Module Configuration

This refers to the MAC Vectors Configuration set up in the Getting Started section.

General Operation Fields

  • Text: The text to generate embeddings for.

Additional Properties

  • Model Name: Indicates the embedding model to be used (default is text-embedding-ada-002).

XML Configuration

Below is the XML configuration for this operation:

<
  vectors:embedding-generate-from-text 
  doc:name="Embedding generate from text" 
  doc:id="eacf5862-2b9a-4602-b7d7-0358885986c3" 
  config-ref="<YOUR_CONFIG>" 
  textToAdd="#[payload.text]"
/>

Output Field

This operation responds with a json payload.

Example Output

This output has been converted to JSON.

{
    "Embedding": "Embedding { vector = [0.0064053377, ..., -0.01793744] }",
    "Dimension": 1536,
    "Segment": "TextSegment { text = \"The capital of Switzerland is Bern\" metadata = {} }"
}
  • Embedding: The vector embeddings of the input Text.
  • Dimension: The dimension of the selected embedding model.
  • Segment: The text segment of the input Text.

[Embedding] Add Document to Store

The Embedding add document to store operation adds a document into an embedding store and exports it to a file. The document is ingested into external vector databases.

Embedding Add Document to Store

Input Fields

Module Configuration

This refers to the MAC Vectors Configuration set up in the Getting Started section.

General Operation Fields

  • Store Name: The name of the store in the external Vector Database.
  • Context Path: Contains the full file path for the document to be ingested into the embedding store. Ensure the file path is accessible. You can also use a DataWeave expression for this field, e.g., mule.home ++ "/apps/" ++ app.name ++ "/customer-service.pdf".
  • Max segment size: The segment size of the document to be splitted in.
  • Max overlap size: The overlap size of the segments to fine tune the similarity search.

Context Operation Field

  • File Type: Contains the type of the document to be ingested into the embedding store. Currently, three file types are supported:
    • text: Any type of text files (json, xml, txt, csv, etc.)
    • pdf: Only system-generated
    • url: Only single URL supported

Additional Properties

  • Model Name: Indicates the embedding model to be used (default is text-embedding-ada-002).

XML Configuration

Below is the XML configuration for this operation:

<
  vectors:embedding-add-document-to-store 
  doc:name="Embedding add document to store" 
  doc:id="8c0ab3e2-7085-4cb9-bf55-9eb1bee6d7f4" 
  config-ref="<YOUR_CONFIG>" storeName="mschainaicollection" 
  contextPath="#[payload.path]" 
  maxSegmentSizeInChars="1000"
  maxOverlapSizeInChars="200" 
  fileType="#[payload.fileType]"
/>
 

Output Field

This operation responds with a json payload.

Example Output

This output has been converted to JSON.

{
    "filePath": "https://mac-project.ai/",
    "storeName": "gettingstarted",
    "fileType": "url",
    "status": "updated"
}
  • filePath: The file path or url of the document to be extracted.
  • storeName: The name of the vector store.
  • fileType: The file type selected on the operation.
  • status: The status of the operation.

[Embedding] Add Folder to Store

The Embedding add folder to store operation adds a complete folder into an embedding store. The documents are ingested into external vector databases.

Embedding Add Folder to Store

Input Fields

Module Configuration

This refers to the MAC Vectors Configuration set up in the Getting Started section.

General Operation Fields

  • Store Name: The name of the store in the external Vector Database.
  • Folder Path: Contains the path for the documents to be ingested into the embedding store. Ensure the file path is accessible. You can also use a DataWeave expression for this field, e.g., mule.home ++ "/apps/" ++ app.name ++ "/".
  • Max segment size: The segment size of the document to be splitted in.
  • Max overlap size: The overlap size of the segments to fine tune the similarity search.

Context Operation Field

  • File Type: Contains the type of the document to be ingested into the embedding store. Currently, three file types are supported:
    • text: Any type of text files (json, xml, txt, csv, etc.)
    • pdf: Only system-generated

Additional Properties

  • Model Name: Indicates the embedding model to be used (default is text-embedding-ada-002).

XML Configuration

Below is the XML configuration for this operation:

<
  vectors:embedding-add-folder-to-store 
  doc:name="Embedding add folder to store" 
  doc:id="1b39985e-9804-4ddf-b730-5a0b3450c198" 
  config-ref="<YOUR_CONFIG>" 
  storeName="mschainaicollection"
  maxSegmentSizeInChars="1000" 
  maxOverlapSizeInChars="200" 
  folderPath="#[payload.path]"
/>
 
 

Output Field

This operation responds with a json payload.

Example Output

This output has been converted to JSON.

{
    "folderPath": "/Users/amir.khan/Documents/Downloads/patch 8",
    "filesCount": 6,
    "storeName": "gettingstarted",
    "status": "updated"
}
  • folderPath: The folder path to the files to be ingested.
  • storeName: The name of the vector store.
  • filesCount: The number of files ingested.
  • status: The status of the operation.

[Embedding] Add Text to Store

The Embedding add text to store operation adds a text into an embedding store.

Embedding Add Text to Store

Input Fields

Module Configuration

This refers to the MAC Vectors Configuration set up in the Getting Started section.

General Operation Fields

  • Store Name: The name of the store in the external Vector Database.
  • Text: Contains text to be vectorised.

Additional Properties

  • Model Name: Indicates the embedding model to be used (default is text-embedding-ada-002).

XML Configuration

Below is the XML configuration for this operation:

<
  vectors:embedding-add-text-to-store 
  doc:name="Embedding add text to store" 
  doc:id="9ab96d9c-51fd-4c3e-9669-3de4624fa2c0" 
  config-ref="<YOUR_CONFIG>" 
  storeName="mschainaicollection" 
  textToAdd="#[payload.text]"
/>
 

Output Field

This operation responds with a json payload.

Example Output

This output has been converted to JSON.

{
    "textSegment": "TextSegment { text = \"The capital of Switzerland is Bern\" metadata = {} }",
    "textEmbedding": "Embedding { vector = [0.0064053377, .[..]., -0.01793744] }",
    "storeName": "gettingstarted",
    "status": "added"
}
  • textSegment: The text segment of the request.
  • textEmbedding: The vectorised embeddings for the text segment.
  • storeName: The name of the vector store.
  • status: The status of the operation.

[Embedding] Query from Store

The Embedding query from store operation retrieve information based on a plain text prompt from an embedding store.

Embedding Get Info from Store

Input Fields

Module Configuration

This refers to the MAC Vectors Configuration set up in the Getting Started section.

General Operation Fields

  • Store Name: The name of the vector collection in the Vector database.
  • Question: The prompt to be sent to the LLM along with the embedding store to respond to.
  • Max results: The maximum number of results to query back. default (3).
  • Min Score: The min score for the similarity search (0 - 1), default (0.8).

Additional Properties

  • Model Name: Indicates the model to be used (default is gpt-3.5-turbo).

XML Configuration

Below is the XML configuration for this operation:

<vectors:embedding-get-info-from-store 
  doc:name="Embedding get info from store" 
  doc:id="addc46ed-0f89-4ae4-85e3-4be6445450eb" 
  config-ref="MAC_AI_Llm_configuration" 
  storeName='#[mule.home ++ "/apps/" ++ app.name ++ "/knowledge-center.store"]' 
  data="#[payload.prompt]"
/>

Output Field

This operation responds with a json payload.

Example Output

This output has been converted to JSON.

{
    "question": "Tell me more about Cloudhub High Availability Feature",
    "sources": [
        {
            "absoluteDirectoryPath": "/Users/<user>/Documents/Downloads/patch 8",
            "textSegment": "= CloudHub High Availability Features\nifndef::env-site,env-github[]\ninclude::_attributes.adoc[]\nendif::[]\n:page-aliases: runtime-manager::cloudhub-fabric.adoc,\....\n\n== Worker Scale-out",
            "individualScore": 0.9282029356714594,
            "file_name": "docs-runtime-manager__cloudhub_modules_ROOT_pages_cloudhub-fabric.adoc",
            "full_path": "/Users/<user>/Documents/Downloads/patch 8docs-runtime-manager__cloudhub_modules_ROOT_pages_cloudhub-fabric.adoc"
        },
        {
          ...
        },
        {
          ...
        }
    ],
    "response": "= CloudHub High Availability Features\.. (...) \..distributes HTTP requests among your assigned workers.\n. Persistent message queues (see below)",
    "maxResults": 3,
    "storeName": "gettingstarted",
    "minimumScore": 0.7
}
  • question: The question of the request.
  • sources: The sources identified by the similarity search.
    • absoluteDirectoryPath: The full path to the file which contains relevant text segment.
    • textSegment: The relevant text segment.
    • individualScore: The score of the similarity search based on the question.
    • file_name: The name of the file, where the text segment was found.
    • full_path: The full path to the file.
  • response: The collected response of all relevant text segment. This is the response will is sent to the LLM.
  • maxResults: The maximum number of text segments considered.
  • storeName: The name of the vector store.
  • minimumScore: The minimum score for the result.

Example Use Cases

This operation can be particularly useful in scenarios such as:

  • Knowledge Management Systems: Adding new documents to an organizational knowledge base.
  • Customer Support: Storing customer interaction documents for quick retrieval and analysis.
  • Content Management: Ingesting various types of documents (text, PDF, URL) into a centralized repository for easy access and searchability.