Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Azure OpenAI Service provides access to OpenAI models through Microsoft Azure with enterprise features, compliance, and regional deployment. Model Class: OpenAIChatModel (uses Azure provider)

Authentication

export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_API_KEY="..."
export OPENAI_API_VERSION="2024-02-15-preview"

Examples

from upsonic import Agent, Task
from upsonic.models.azure import AzureModel

model = AzureModel(model_name="gpt-4o")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result)

Model Settings

You can set model parameters in two ways: on the model or on the Agent. On the model:
from upsonic import Agent, Task
from upsonic.models.azure import AzureModel, AzureModelSettings

model = AzureModel(
    model_name="gpt-4o",
    settings=AzureModelSettings(max_tokens=1024, temperature=0.7)
)
agent = Agent(model=model)
On the Agent:
from upsonic import Agent, Task
from upsonic.models.azure import AzureModelSettings

agent = Agent(
    model="azure/gpt-4o",
    settings=AzureModelSettings(max_tokens=1024, temperature=0.7)
)

Parameters

ParameterTypeDescriptionDefaultSource
max_tokensintMaximum tokens to generateModel-specificBase
temperaturefloatSampling temperature (0.0-2.0)1.0Base
top_pfloatNucleus sampling1.0Base
seedintRandom seedNoneBase
stop_sequenceslist[str]Stop sequencesNoneBase
presence_penaltyfloatToken presence penalty0.0Base
frequency_penaltyfloatToken frequency penalty0.0Base
logit_biasdict[str, int]Token likelihood modifierNoneBase
parallel_tool_callsboolAllow parallel toolsTrueBase
timeoutfloatRequest timeout (seconds)600Base