Skip to main content

Overview

Generate AI-powered answers to questions using your uploaded data as context. Moorcheh supports 8 state-of-the-art AI models for intelligent answer generation.
The Answer API supports two modes: Search Mode (with namespace) and Direct AI Mode (empty namespace for direct model calls).

Supported AI Models

Model IDProviderDescription
anthropic.claude-sonnet-4-20250514-v1:0AnthropicHybrid reasoning, efficient code generation
anthropic.claude-sonnet-4-5-20250929-v1:0AnthropicLatest Claude with agentic search
meta.llama4-maverick-17b-instruct-v1:0Meta1M token context, function calling
meta.llama3-3-70b-instruct-v1:0MetaAdvanced reasoning capabilities
amazon.nova-pro-v1:0Amazon300K context, complex reasoning
deepseek.r1-v1:0DeepSeekAdvanced reasoning and code generation
openai.gpt-oss-120b-1:0OpenAIHybrid reasoning, research
qwen.qwen3-32b-v1:0QwenText and code generation

Basic Usage

from moorcheh_sdk import MoorchehClient

client = MoorchehClient(api_key="your-api-key")

# Generate answer from your data
answer = client.get_answer(
    namespace="my-documents",
    query="What is Moorcheh?",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0"
)

print(answer["answer"])

Search Mode vs Direct AI Mode

  • Search Mode
  • Direct AI Mode

Search Mode (with namespace)

When you provide a namespace, the API searches your data for relevant context and uses it to generate contextual answers.
# Answer based on your data
answer = client.get_answer(
    namespace="my-documents",
    query="What are the main features?",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0",
    top_k=5  # Number of documents to consider
)
Best for:
  • Q&A over your documents
  • Knowledge base queries
  • Context-aware responses

Advanced Parameters

Temperature Control

Control response creativity (0.0 - 2.0):
# More deterministic (lower temperature)
answer = client.get_answer(
    namespace="my-documents",
    query="List the API endpoints",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0",
    temperature=0.1
)

# More creative (higher temperature)
answer = client.get_answer(
    namespace="my-documents",
    query="Write a blog post about our features",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0",
    temperature=0.9
)

Custom Prompts

Add custom instructions for the AI:
answer = client.get_answer(
    namespace="my-documents",
    query="Explain our pricing",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0",
    headerPrompt="You are a helpful sales assistant. Be concise and friendly.",
    footerPrompt="Always end with a call to action."
)

Chat History

Maintain conversation context:
answer = client.get_answer(
    namespace="my-documents",
    query="What about the advanced features?",
    ai_model="anthropic.claude-sonnet-4-20250514-v1:0",
    chatHistory=[
        {"role": "user", "content": "What features do you offer?"},
        {"role": "assistant", "content": "We offer semantic search, vector storage..."}
    ]
)

Response Format

{
  "answer": "Moorcheh is a lightning-fast semantic search engine...",
  "sources": [
    {
      "id": "doc-123",
      "score": 0.95,
      "text": "Source content..."
    }
  ]
}

Model Selection Guide

General Purpose

Claude Sonnet 4 - Best balance of speed and quality

Advanced Reasoning

Claude Sonnet 4.5 - Latest model with agentic capabilities

Long Context

Llama 4 Maverick - 1M token context window

Code Generation

DeepSeek R1 - Specialized for coding tasks

Best Practices

  • Use Claude Sonnet 4 for general queries
  • Use DeepSeek R1 for code-related questions
  • Use Llama 4 Maverick for very long documents
  • Use 3-5 documents for focused answers
  • Use 8-10 documents for comprehensive responses
  • Higher values may include irrelevant context
  • 0.1-0.3 for factual, deterministic answers
  • 0.7 for balanced responses (default)
  • 0.9-1.0 for creative content generation
  • Add role context in headerPrompt
  • Specify output format requirements
  • Keep prompts concise and clear

Next Steps