Set Global Model
ProxAI provides a way to set the global model for all API calls. This is useful for abstracting the model choice from the API call.
def simple_question():
return px.generate_text(prompt="Which company did make you?")
provider_models = px.models.list_models()
for provider_model in provider_models:
px.set_model(provider_model)
answer = simple_question()
print(f'{provider_model}: {answer}')
(claude, 3-haiku): I was created by Anthropic, a technology company based ...
(claude, 3-sonnet): I am an artificial intelligence created by Anthropic. I...
(claude, 3.5-sonnet): I was created by Anthropic....
(claude, 3.5-sonnet-v2): I'm Claude, created by Anthropic. I aim to be direct an...
...
Parameters
px.set_model()
parameters:
Option | Type | Default Value | Description |
---|---|---|---|
provider_model | Union[Tuple[str, str], px.types.ProviderModel] | None | Provider model to set as global model for
generate_text API calls. If not set, ProxAI decides the model for
un-specified models in generate_text calls. |