Documentation Index
Fetch the complete documentation index at: https://docs.getmuster.io/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Integration
Add quality emission after each assistant run completes:
from openai import OpenAI
client = OpenAI()
# muster_emit( # add after job completes
# agent_id="customer-support-assistant")
def run_assistant(thread_id: str, assistant_id: str, user_message: str) -> str:
# Add message to thread
client.beta.threads.messages.create(
thread_id=thread_id,
role="user",
content=user_message
)
# Run the assistant
run = client.beta.threads.runs.create_and_poll(
thread_id=thread_id,
assistant_id=assistant_id,
)
# Get the response
messages = client.beta.threads.messages.list(thread_id=thread_id)
output = messages.data[0].content[0].text.value if messages.data else ""
# Emit to Muster
muster_emit(
job_id=run.id,
overall_passed=run.status == "completed" and bool(output),
token_input=run.usage.prompt_tokens if run.usage else 0,
token_output=run.usage.completion_tokens if run.usage else 0,
model=run.model,
checks=[
quality.Check(
check_id="output_not_empty",
severity="HIGH",
passed=bool(output)
),
quality.Check(
check_id="run_completed",
severity="HIGH",
passed=run.status == "completed",
actual=run.status
),
]
)
return output