Skip to main content

Moss semantic search integration for sim.ai workflows

Project description

sim-moss

Moss semantic search integration for sim.ai workflows.

Provides MossSimSearch — a lightweight adapter that queries a preloaded Moss index and returns documents in sim.ai's expected {"content", "score", "source"} shape, ready to be served from a webhook that sim.ai calls as an external tool.

Installation

pip install sim-moss

Prerequisites

  • Moss project ID and project key (get them from Moss Portal)
  • Python 3.10+
  • A sim.ai workspace with a deployed workflow

Quick Start

from sim_moss import MossSimSearch

search = MossSimSearch(
    project_id="your-id",
    project_key="your-key",
    index_name="my-docs",
)
await search.load_index()

result = await search.search("How do I reset my password?")
print(result.results)      # [{"content": "...", "score": 0.94, "source": "faq.md"}, ...]
print(result.time_taken_ms)  # 4

Wiring into a sim.ai Workflow

sim.ai workflows can call external HTTP tools. Point an HTTP tool node at a webhook server that wraps MossSimSearch:

POST /search
Body: {"query": "{{user_message}}"}

The response shape — {"results": [...], "time_taken_ms": 4} — maps directly to sim.ai's tool output. See examples/cookbook/sim for a complete FastAPI server and setup guide.

Configuration

MossSimSearch

Parameter Default Description
project_id MOSS_PROJECT_ID env var Moss project ID
project_key MOSS_PROJECT_KEY env var Moss project key
index_name (required) Name of the Moss index to query
top_k 5 Number of results to retrieve per query
alpha 0.8 Blend: 1.0 = semantic only, 0.0 = keyword only

Methods

Method Description
load_index() Async. Pre-load the Moss index — call once at server startup
search(query) Async. Query Moss and return a SimSearchResult

SimSearchResult

Field Type Description
results list[dict] Documents with content, score, and optional source
time_taken_ms int | None Moss query latency

License

This integration is provided under the BSD 2-Clause License.

Support

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

sim_moss-0.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

sim_moss-0.0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file sim_moss-0.0.1.tar.gz.

File metadata

  • Download URL: sim_moss-0.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sim_moss-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3af28c5fbe8e319b854e2e0ef6ac4b7a64339dbb89c7f0f58977d0a81569d17a
MD5 40b5ec18287eb70a49d6094a35802771
BLAKE2b-256 d4722940002200363893045459ef5e8bce5a610297ab6d1b425f0fdfde8b3ded

See more details on using hashes here.

File details

Details for the file sim_moss-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: sim_moss-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sim_moss-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e2161c06b5d10ea793ec17a0e2ca31dad709e8c76e824f04b2310d0c1884540
MD5 1e01a552482d80f60e30d1f437495cb0
BLAKE2b-256 7bb9ddf18ef5b246ce1a9d3e5a29a963382f947cf9a59566ef1f05682958fa4b

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