bio_reasoning.utils module#
- bio_reasoning.utils.query_chat_completion(base_url: str, api_key: str, model_name: str, messages: List[Dict[str, Any]], timeout: int = 600) str[source]#
Sends a chat completion request to an external API.
- Parameters:
base_url (str) – Base URL of the API service.
api_key (str) – API key for authentication.
model_name (str) – Name of the model to use for chat completions.
messages (List[Dict[str, str | List[Dict[str, str]]]]) – List of message objects describing the conversation.
timeout (int, optional) – Timeout for the request in seconds. Defaults to 600.
- Returns:
The content of the API’s response.
- Return type:
str
- Raises:
RuntimeError – If the API request fails with an HTTP error.