Access GPT-4, GPT-4 Turbo, and GPT-3.5 models through the OpenAI integration.
Setup
Add Provider
mixtrain provider add openaiOr via SDK:
from mixtrain import MixClient
client = MixClient()
client.create_model_provider(
provider_type="openai",
secrets={"api_key": "sk-..."}
)Once added, OpenAI models are available via mixtrain model catalog.
Usage
from mixtrain import get_model
model = get_model("gpt4")
result = model.run({
"prompt": "Write a haiku about machine learning",
"max_tokens": 100
})Available Models
| Model ID | Description |
|---|---|
gpt-4 | Most capable GPT-4 model |
gpt-4-turbo | Faster GPT-4 with larger context |
gpt-4o | Optimized GPT-4 |
gpt-3.5-turbo | Fast and cost-effective |
Configuration Options
| Parameter | Description |
|---|---|
max_tokens | Maximum tokens to generate |
temperature | Sampling temperature (0-2) |
top_p | Nucleus sampling parameter |
frequency_penalty | Reduce repetition |
presence_penalty | Encourage new topics |
Getting an API Key
- Sign up at platform.openai.com
- Navigate to API Keys
- Create a new secret key
- Add it to Mixtrain using the setup steps above