enhancement: OpenAI API

api.together.xyz, api.replicate.com
This commit is contained in:
Timothy J. Baek 2024-04-28 10:20:40 -07:00
parent 7bc17da534
commit 9832e6edba

View file

@ -171,6 +171,7 @@ async def fetch_url(url, key):
def merge_models_lists(model_lists):
log.info(f"merge_models_lists {model_lists}")
merged_list = []
for idx, models in enumerate(model_lists):
@ -199,14 +200,16 @@ async def get_all_models():
]
responses = await asyncio.gather(*tasks)
log.info(f"get_all_models:responses() {responses}")
models = {
"data": merge_models_lists(
list(
map(
lambda response: (
response["data"]
if response and "data" in response
else None
if (response and "data" in response)
else (response if isinstance(response, list) else None)
),
responses,
)