openai

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package openai provides an OpenAI LLM provider for langrails.

Supports all OpenAI chat completion models including GPT-4o, GPT-4, o1, and GPT-3.5. Features include streaming, tool calling, structured output, and reasoning mode for o-series models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*compat.Config)

Option configures the OpenAI provider.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom base URL (useful for Azure OpenAI or proxies).

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements langrails.Provider for OpenAI's API.

func New

func New(apiKey string, opts ...Option) *Provider

New creates a new OpenAI provider with the given API key and options.

func (*Provider) Complete

Complete sends a completion request and returns the full response.

func (*Provider) Stream

Stream sends a completion request and returns a channel of streaming events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL