api
¶
APIServer
¶
APIServer(
model: str,
base_url: Optional[str] = None,
api_key: Optional[str] = None,
custom_llm_provider: Optional[str] = None,
cost_currency: str = "USD",
**kwargs: Any
)
Bases: BaseServer
The server for API models. It is a wrapper of litellm.completion.
See LiteLLM for available models and providers. See completion for available options.
Source code in src/appl/servers/api.py
close
¶
create
¶
create(
args: GenArgs, gen_id: str, **kwargs: Any
) -> CompletionResponse
Create a CompletionResponse from the model with given arguments.
Parameters:
-
args
(GenArgs
) –The arguments for generating the response
-
gen_id
(str
) –The ID of the generation
-
**kwargs
(Any
, default:{}
) –Additional keyword arguments
Returns: The response from the model.
Source code in src/appl/core/server.py
chat_completion
¶
chat_completion(**kwargs: Any) -> CompletionResponse
Wrap the litellm.completion function to add tracing and logging.