@@ -19,12 +19,10 @@ def to_url(self):
1919 Convert the endpoint to its full URL.
2020 """
2121 match self :
22- case self .AI_API_GITHUBCOPILOT :
22+ case AI_API_ENDPOINT_ENUM .AI_API_GITHUBCOPILOT :
2323 return f"https://{ self } "
24- case self .AI_API_MODELS_GITHUB :
24+ case AI_API_ENDPOINT_ENUM .AI_API_MODELS_GITHUB :
2525 return f"https://{ self } /inference"
26- case _:
27- raise ValueError (f"Unsupported Model Endpoint: { self } " )
2826
2927COPILOT_INTEGRATION_ID = 'vscode-chat'
3028
@@ -62,7 +60,8 @@ def list_capi_models(token: str) -> dict[str, dict]:
6260 case AI_API_ENDPOINT_ENUM .AI_API_MODELS_GITHUB :
6361 models_catalog = 'catalog/models'
6462 case _:
65- raise ValueError (f"Unsupported Model Endpoint: { api_endpoint } " )
63+ raise ValueError (f"Unsupported Model Endpoint: { api_endpoint } \n "
64+ f"Supported endpoints: { [e .to_url () for e in AI_API_ENDPOINT_ENUM ]} " )
6665 r = httpx .get (httpx .URL (api_endpoint ).join (models_catalog ),
6766 headers = {
6867 'Accept' : 'application/json' ,
@@ -76,9 +75,6 @@ def list_capi_models(token: str) -> dict[str, dict]:
7675 models_list = r .json ().get ('data' , [])
7776 case AI_API_ENDPOINT_ENUM .AI_API_MODELS_GITHUB :
7877 models_list = r .json ()
79- case _:
80- raise ValueError (f"Unsupported Model Endpoint: { api_endpoint } \n "
81- f"Supported endpoints: { [e .to_url () for e in AI_API_ENDPOINT_ENUM ]} " )
8278 for model in models_list :
8379 models [model .get ('id' )] = dict (model )
8480 except httpx .RequestError as e :
0 commit comments