Pipecat Moss Integration
Moss delivers sub-10ms semantic retrieval, ensuring your Pipecat AI voice agents respond naturally without noticeable delays.
Installation
Install the package
pip install pipecat-moss
Prerequisites
- Moss project ID and project key (get them from Moss Portal)
- Deepgram, OpenAI, Cartesia API keys (to run the example)
Usage with Pipecat Pipeline
Pipecat-Moss integrates seamlessly into a Pipecat pipeline, enabling efficient retrieval-based operations. It leverages Pipecat's modular architecture to inject semantic context for Voice AI Agents.
import os
import asyncio
from pipecat_moss import MossRetrievalService
moss_service = MossRetrievalService(
project_id=os.getenv("MOSS_PROJECT_ID"),
project_key=os.getenv("MOSS_PROJECT_KEY"),
system_prompt="Relevant passages from the Moss knowledge base:\n\n",
)
async def setup_indexes():
await moss_service.load_index(os.getenv("MOSS_INDEX_NAME"))
asyncio.run(setup_indexes())
pipeline = Pipeline([
transport.input(), # audio/user input
stt, # speech to text
context_aggregator.user(), # add user text to context
moss_service.query(os.getenv("MOSS_INDEX_NAME"), top_k=5, alpha=0.8), # retrieve relevant docs from Moss
llm, # LLM generates response
tts, # TTS synthesis
transport.output(), # stream audio back to user
context_aggregator.assistant(), # store assistant response
])
setup_indexes() must be awaited before the pipeline starts so the service can load the Moss index. See examples/moss-retrieval-demo.py for a complete working example.
Pipecat Compatibility
Requires Python 3.11+, pipecat-ai>=1.8,<2 and moss>=1.20.0. Tested with Pipecat 1.13. Use pipecat-moss 0.0.x only with Pipecat < 1.8.
Contributing
If you are contributing or want to build from source, follow the CONTRIBUTING.md setup steps.
Running the Example
Setup Environment Variables
Create a .env file in the root directory with the following content:
MOSS_PROJECT_ID= Your Moss Project ID
MOSS_PROJECT_KEY= Your Moss Project Key
MOSS_INDEX_NAME= Your Moss Index Name
DEEPGRAM_API_KEY= Your DEEPGRAM API KEY
CARTESIA_API_KEY= Your CARTESIA API KEY
OPENAI_API_KEY= Your OpenAI Key
Or pass them directly when creating the MossRetrievalService.
Creating a Moss Index (One-time Setup)
Before using Moss in your pipeline, you need to create an index and populate it with documents:
python examples/moss-create-index-demo.py
Run the Example
python examples/moss-retrieval-demo.py
Configuration Options
MossRetrievalService
project_id(required): Moss project ID (can use env varMOSS_PROJECT_ID)project_key(required): Moss project key (can use env varMOSS_PROJECT_KEY)system_prompt(default: "Here is additional context retrieved from database:\n\n"): Prefix added ahead of retrieved documentsload_index(index_name): Awaitable method that loads the given index before the pipeline runsquery(index_name, *, top_k=5, alpha=0.8): Returns aMossIndexProcessorfor the specified index;top_kcontrols result count,alphablends semantic vs keyword scoring (0.0 keyword-only, 1.0 semantic-only)
License
This integration is provided under a permissive open source license (BSD-2 or equivalent).
Support
Metadata
Release files for pipecat-moss 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pipecat_moss-0.1.0.tar.gz | 7.4 kB | Without provenance | Details for pipecat_moss-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pipecat_moss-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pipecat_moss-0.1.0-py3-none-any.whl |
Total release size: 14.6 kB
Release files / pipecat_moss-0.1.0.tar.gz
| Download URL | pipecat_moss-0.1.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3efdec1674998143a9df3de0b2d6cdaa52a4d6e95eea7389d6cd47d016f5fa07
|
|
BLAKE2b-256 checksum How to use checksums |
3d5842a5ec227d70a315dda1044482bfc9d4cf7139c63b75c9baec18fbbd0fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pipecat_moss-0.1.0-py3-none-any.whl
| Download URL | pipecat_moss-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
137d3218109e6cb906f9ef670be37e8c622b3f31b86a7a8ba5358a63e2b616ed
|
|
BLAKE2b-256 checksum How to use checksums |
473aa74a2de52236ab083fb8ccd2de50c5c9c0fdc5629f563e2603a572b5abcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for pipecat-moss 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.