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:
- Moss Agent Notebook: A Jupyter notebook walking through installation, indexing, and agent usage.
- Moss Agent Script: A concise Python script demonstrating the ReAct agent flow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_tools_moss-0.2.0.tar.gz.
File metadata
- Download URL: llama_index_tools_moss-0.2.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
847483cc1b54ec7c94dcdde3cfd0bfed1a179f0dc5cb957b05a9f756397fc295
|
|
| MD5 |
d7f1c3515d0656fd103b21f8d54e90ee
|
|
| BLAKE2b-256 |
709c48c6dfa0c5e78e361f73a1eb80283bad0d795aa4a6a3653016ffd676d3ad
|
File details
Details for the file llama_index_tools_moss-0.2.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_moss-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97e63ab897a039fbef63196af2afac2bbf7ffec7cbe31616233e9bd07a6ac1b4
|
|
| MD5 |
2a142b0a87e0571684fdb5f66e56c0dc
|
|
| BLAKE2b-256 |
937c366eeec4a60a40ab81fbde9b2d82b74487f172b78e271120a8c75f0ed8d9
|