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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_tools_moss-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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.1.0.tar.gz
Algorithm Hash digest
SHA256 b211398d9bd08c5520cdeee920027a9099fe301a67fed28babd9ea384063f635
MD5 6060f14a231622e250b1aae576c84e06
BLAKE2b-256 26ed860050a1f9c92bcfaf72ce6b715de266ea2142756c001f8d9b04e5b33c96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_tools_moss-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cecff9c9a7c0054481be35d5d47c48c390d4c60d281b65ce2ef6aa4d5a26dafc
MD5 8ccdcaaf54ad9d91d2386db1497515b9
BLAKE2b-256 3e4276e500889b233857eac5cffc934e949a681d927e7ab2194be7c019282917

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