> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrails

> TokenLab model çıktılarını Guardrails ile doğrulayın

## Genel Bakış

Guardrails, LLM API arayüzü ile uyumlu her türlü çağrılabilir (callable) öğeyi sarmalayabilir. TokenLab için, OpenAI SDK'yı TokenLab'in temel URL'si ile yapılandırın ve chat completions çağrılabilir öğesini guard'ınıza iletin.

<Note>
  **Tür**: Doğrulama ve yapılandırılmış çıktı çerçevesi

  **Birincil Yol**: OpenAI uyumlu Chat Completions

  **Destek Güveni**: Desteklenen OpenAI uyumlu yol
</Note>

## Ortam

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## Örnek

```python theme={null}
import os

from guardrails import Guard
from openai import OpenAI
from pydantic import BaseModel, Field


class Pet(BaseModel):
    pet_type: str = Field(description="Species of pet")
    name: str = Field(description="A unique pet name")


guard = Guard.for_pydantic(output_class=Pet)

client = OpenAI(
    api_key=os.environ["TOKENLAB_API_KEY"],
    base_url="https://api.tokenlab.sh/v1",
)

raw_output, validated_output, *rest = guard(
    llm_api=client.chat.completions.create,
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "What kind of pet should I get?"}],
)
```

## Uç Nokta Notları

Guardrails, LLM çağrısı etrafındaki doğrulamaya odaklanır. Chat-completions akışları için OpenAI uyumlu yolu kullanın veya uygulamanızın yerel bir TokenLab uç noktasına ihtiyacı varsa özel bir çağrılabilir öğe (custom callable) iletin.
