Docs
Configuration

Configuration

The Tatry API can be configured through various methods to customize its behavior and performance. This guide covers the available configuration options and methods.

Basic Configuration

from tatry import TatryRetriever
 
client = TatryRetriever(
    api_key="your-api-key",
    max_results=5  # Number of documents to return
)
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "max_results": 5,
    "query": "your query here"
  }'

Configuration Options

Via Constructor/Headers

client = TatryRetriever(
    api_key="your-api-key",
 
    # Result settings
    max_results=5,
 
    # Source preferences
    allowed_sources=["wikipedia", "academic"],
 
    # Performance
    timeout=30  # seconds
)
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -H "X-Tatry-Timeout: 30" \
  -d '{
    "max_results": 5,
    "allowed_sources": ["wikipedia", "academic"],
    "query": "your query here"
  }'

Via Environment Variables

The SDK will respect these environment variables:

export TATRY_API_KEY="your-api-key"
export TATRY_MAX_RESULTS=5

Via Configuration File

Create tatry_config.json:

{
	"api_key": "your-api-key",
	"max_results": 5,
	"allowed_sources": ["wikipedia", "academic"],
	"timeout": 30
}

Load configuration:

client = TatryRetriever.from_config("tatry_config.json")
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer $(jq -r .api_key tatry_config.json)" \
  -H "Content-Type: application/json" \
  -d "$(jq '. + {"query":"your query here"}' tatry_config.json)"

Source Control

Control which content sources are used:

# Include only specific sources
client.allowed_sources = ["wikipedia", "academic"]
 
# Reset to use all available sources
client.allowed_sources = None
# Include only specific sources
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -d '{
    "allowed_sources": ["wikipedia", "academic"],
    "query": "your query here"
  }'

Performance Settings

Timeouts

# Set request timeout
client.timeout = 30  # seconds
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -H "X-Tatry-Timeout: 30" \
  -d '{
    "query": "your query here"
  }'

Environment-Specific Settings

Development

client = TatryRetriever(
    api_key="your-api-key",
    environment="development",
    max_results=2
)
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -H "X-Tatry-Environment: development" \
  -d '{
    "max_results": 2,
    "query": "your query here"
  }'

Production

client = TatryRetriever(
    api_key="your-api-key",
    environment="production",
    max_results=10,
    timeout=60
)
curl -X POST https://api.tatry.dev/v1/retrieve \
  -H "Authorization: Bearer your-api-key" \
  -H "X-Tatry-Environment: production" \
  -H "X-Tatry-Timeout: 60" \
  -d '{
    "max_results": 10,
    "query": "your query here"
  }'

Next Steps