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.1.tar.gz (38.9 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.1-py3-none-any.whl (49.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for sinapsis_llama_index-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a6835892585ef506aa412ad46185c6618d4d9399b7374cb2374f84f6323ac8c0
MD5 81e774d2eea9a41aae22d1dd9d1a8ab8
BLAKE2b-256 9c8551157d6efc4bb29c83423d3a60c4fd0b769f7cc4db5f90f3459c280e3d20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sinapsis_llama_index-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc6e185037c59321a8d8048328bfa48766c4f3ac4d2bae153cf1d971c8038513
MD5 48d050475a6fbec40230489b8f13705c
BLAKE2b-256 2070c7fa09520ca7a25a17de4a6eff06b5d393b465a2a54ff48200e5fa96b2d4

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