Skip to main content

Sinapsis templates for LlamaIndex retrieval and ingestion.

Project description



Sinapsis LlamaIndex

Sinapsis templates for LlamaIndex ingestion, retrieval, reranking, and semantic caching.

🐍 Installation🚀 Features📚 Usage example📙 Documentation🔍 License

The sinapsis-llama-index package provides ingestion, retrieval, reranking, and semantic caching templates built on top of LlamaIndex. It is designed to work with Sinapsis packet flows, including plain TextPacket retrieval and LLMConversationPacket.contexts for downstream LLM templates.

🐍 Installation

Install using your package manager of choice. We encourage the use of uv.

Example with uv:

uv pip install sinapsis-llama-index --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

pip install sinapsis-llama-index --extra-index-url https://pypi.sinapsis.tech

🚀 Features

Templates Supported

  • EmbeddingNodeGenerator: Split text documents into chunks and generate embedded TextNode objects.
  • CodeEmbeddingNodeGenerator: Split source-code repositories with CodeSplitter and embed the resulting nodes.
  • LLaMAIndexInsertNodes: Insert embedded nodes into PostgreSQL PGVectorStore tables.
  • LLaMAIndexNodeRetriever: Retrieve nodes from PGVector for both TextPacket and LLMConversationPacket inputs.
  • LLaMAIndexReranker: Rerank selected LLMConversationPacket.contexts categories with SentenceTransformerRerank.
  • LLaMAIndexSemanticCacheLookup: Reuse cached LLM responses from PGVector when a semantically similar prompt is found under the same request scope.
  • LLaMAIndexSemanticCacheWrite: Persist completed LLM responses into a PGVector-backed semantic cache for future reuse.
  • LLaMAIndexClearTable: Clear all rows from a PGVector table while keeping its schema.
  • LLaMAIndexDeleteTable: Drop a PGVector table and remove all stored vectors.

[!TIP] Use CLI command sinapsis info --all-template-names to show a list with all the available Template names installed with Sinapsis Chatbots Base.

📚 Usage example

The following configuration assumes a PGVector table is already populated and shows a typical retrieval pipeline: create an LLMConversationPacket, retrieve candidate contexts from PGVector, and rerank them before a downstream LLM template consumes the results.

Config
agent:
  name: reranker_demo
  description: Retrieve and rerank help-center contexts before they are consumed by an LLM.

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: LLMConversationInput
    class_name: LLMConversationInput
    template_input: InputTemplate
    attributes:
      prompt: "How long does the password reset link remain valid?"
      system_prompt: "Use the best retrieved context."

  - template_name: LLaMAIndexNodeRetriever
    class_name: LLaMAIndexNodeRetriever
    template_input: LLMConversationInput
    attributes:
      embedding_config:
        model_name: Snowflake/snowflake-arctic-embed-xs
        embed_batch_size: 10
        device: cpu
        trust_remote_code: true
      db_config:
        user: myuser
        password: mypass
        port: 5432
        host: localhost
        db_name: sinapsis_db
        table_name: sinapsis_data
      retrieve_args:
        query_mode: default
        similarity_top_k: 8
        threshold: 0.3

  - template_name: LLaMAIndexReranker
    class_name: LLaMAIndexReranker
    template_input: LLaMAIndexNodeRetriever
    attributes:
      rerank_config:
        model: cross-encoder/stsb-distilroberta-base
        top_n: 2
        device: cpu
        keep_retrieval_score: false
        trust_remote_code: true
      rerank_categories:
        - rag

📙 Documentation

Documentation for this and other sinapsis packages is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinapsis_llama_index-0.3.2.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinapsis_llama_index-0.3.2-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_llama_index-0.3.2.tar.gz.

File metadata

File hashes

Hashes for sinapsis_llama_index-0.3.2.tar.gz
Algorithm Hash digest
SHA256 344b81fc6f272f368fcae2b0e8a017cc429ef509e09935f0accab64fc3863b2f
MD5 2490cb0b0235169e8f153d70f5795c0f
BLAKE2b-256 56f8d830b0c1d9fb7721dc8c026cc3358f59ec7c59b2c63f883daed7937cf5e6

See more details on using hashes here.

File details

Details for the file sinapsis_llama_index-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_llama_index-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a59ae640a398cd6cecfa50cbf7fa67f21a4f7dc8be3df258ea373ed8400b32c
MD5 aa06135efcaa97f2f23b6133afb9a7fb
BLAKE2b-256 b50ccd08211a9c774cf71891ab551e428dcbdbfbe82f9d31ce2264e9a204f6d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page