Skip to main content

llama-index tools moss integration

Project description

Moss Tool

This tool provides integration with Moss, a real-time semantic search engine.

Installation

pip install llama-index-tools-moss

Usage

You can use the MossToolSpec to interact with your Moss index.

Initialization

import os
from llama_index.tools.moss import MossToolSpec, QueryOptions
from inferedge_moss import MossClient

# Initialize the client
# The client requires a Moss project key and a project ID
MOSS_PROJECT_KEY = os.getenv("MOSS_PROJECT_KEY")
MOSS_PROJECT_ID = os.getenv("MOSS_PROJECT_ID")
client = MossClient(project_id=MOSS_PROJECT_ID, project_key=MOSS_PROJECT_KEY)

# Initialize the tool
# Note: You can customize top_k and alpha through query_options (hybrid search weight)
options = QueryOptions(alpha=0.6, top_k=9, model_id="moss-minilm")
tool = MossToolSpec(
    client=client, index_name="my_index", query_options=options
)

# Convert to tool list for agents
tools = tool.to_tool_list()

Indexing Documents

You can index documents into your Moss index using the index_docs method:

from inferedge_moss import DocumentInfo

docs = [
    DocumentInfo(
        text="LlamaIndex is great!", metadata={"source": "review.txt"}
    ),
    DocumentInfo(text="Moss is fast!", metadata={"source": "specs.txt"}),
]

# Index the documents
await tool.index_docs(docs)

Parameters

  • client (MossClient): The initialized Moss client.
  • index_name (str): The name of the index to query.
  • query_options (QueryOptions): Configuration options for the tool (optional).
    • top_k (int, default=5): Number of results to return.
    • alpha (float, default=0.5): Weight for hybrid search (0.0=keyword, 1.0=semantic).
    • model_id (str, default="moss-minilm"): The model ID to use for embeddings.

MODEL IDs

  • moss-minilm: Fast, lightweight (default). Best for speed-first, edge/offline use.
  • moss-mediumlm: Higher accuracy with reasonable performance. Best when search quality is important.

Examples

The examples/ directory contains:

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

llama_index_tools_moss-0.3.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

llama_index_tools_moss-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_moss-0.3.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_moss-0.3.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_moss-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0cb23086aa28a006a906adce9adb753463541b13155ae6f0d6478079aa5f1789
MD5 b667b0bed1e20ee2496b3ee8969d949a
BLAKE2b-256 b568b568ca91c0af088739ede3c108882faae89a9e4d2dcf68e963546e29a870

See more details on using hashes here.

File details

Details for the file llama_index_tools_moss-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_moss-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_moss-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0255fa4388553e7e13b8a29cfc769afe64b069a62c6d3d1f84d41d5fc613aa81
MD5 1ce7b1236d86eb488d429592e924e746
BLAKE2b-256 4b23d00ea2c95026b6bd96273547b6c82d522385c40c6b85a63921868b9c5913

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