Search documentation of Ragex

# Ragex.AI.Provider.OpenAI (Ragex v0.4.0)

View Source

OpenAI API provider implementation.

Supports GPT-4, GPT-4-turbo, and GPT-3.5-turbo models via the OpenAI API.

## Configuration

    config :ragex, :ai_providers,
      openai: [
        endpoint: "https://api.openai.com/v1",
        model: "gpt-4-turbo",
        options: [
          temperature: 0.7,
          max_tokens: 2048
        ]
      ]

## Environment Variables

Requires `OPENAI_API_KEY` to be set.

## Supported Models

- `gpt-4` - Most capable model, best for complex tasks
- `gpt-4-turbo` - Faster and cheaper than GPT-4, optimized for chat
- `gpt-4-turbo-preview` - Latest preview features
- `gpt-3.5-turbo` - Fast and cost-effective for simpler tasks
- `gpt-3.5-turbo-16k` - Extended context window

## API Documentation

https://platform.openai.com/docs/api-reference/chat