|
1 | | -from typing import Dict, List |
| 1 | +from typing import Any, Dict, List |
2 | 2 |
|
3 | 3 | from autogen_ext.models.anthropic._model_info import _MODEL_INFO as anthropic_models |
4 | 4 | from autogen_ext.models.ollama._model_info import _MODEL_INFO as ollama_models |
|
9 | 9 |
|
10 | 10 |
|
11 | 11 | @router.get("/") |
12 | | -async def list_models() -> Dict[str, List[str]]: |
| 12 | +async def list_models() -> Dict[str, List[Dict[str, Any]]]: |
| 13 | + # Get the model names from the model info, also get the "function_calling" value for each model |
| 14 | + |
13 | 15 | response = { |
14 | | - "anthropic": list(anthropic_models.keys()), |
15 | | - "ollama": list(ollama_models.keys()), |
16 | | - "openAI": list(openai_models.keys()), |
17 | | - "azureOpenAI": list(openai_models.keys()), |
| 16 | + "anthropic": [ |
| 17 | + { |
| 18 | + "name": model, |
| 19 | + "function_calling": anthropic_models[model]["function_calling"], |
| 20 | + } |
| 21 | + for model in anthropic_models.keys() |
| 22 | + ], |
| 23 | + "ollama": [ |
| 24 | + { |
| 25 | + "name": model, |
| 26 | + "function_calling": ollama_models[model]["function_calling"], |
| 27 | + } |
| 28 | + for model in ollama_models.keys() |
| 29 | + ], |
| 30 | + "openAI": [ |
| 31 | + { |
| 32 | + "name": model, |
| 33 | + "function_calling": openai_models[model]["function_calling"], |
| 34 | + } |
| 35 | + for model in openai_models.keys() |
| 36 | + ], |
| 37 | + "azureOpenAI": [ |
| 38 | + { |
| 39 | + "name": model, |
| 40 | + "function_calling": openai_models[model]["function_calling"], |
| 41 | + } |
| 42 | + for model in openai_models.keys() |
| 43 | + ], |
18 | 44 | } |
19 | 45 |
|
20 | 46 | return response |
0 commit comments