Files
letta-server/letta/llm_api/mistral.py
Kian Jones b8e9a80d93 merge this (#4759)
* wait I forgot to comit locally

* cp the entire core directory and then rm the .git subdir
2025-09-17 15:47:40 -07:00

23 lines
662 B
Python

import aiohttp
from letta.log import get_logger
from letta.utils import smart_urljoin
logger = get_logger(__name__)
async def mistral_get_model_list_async(url: str, api_key: str) -> dict:
url = smart_urljoin(url, "models")
headers = {"Content-Type": "application/json"}
if api_key is not None:
headers["Authorization"] = f"Bearer {api_key}"
logger.debug("Sending request to %s", url)
async with aiohttp.ClientSession() as session:
# TODO add query param "tool" to be true
async with session.get(url, headers=headers) as response:
response.raise_for_status()
return await response.json()