File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 77from PIL import Image
88
99from guidellm .backend .response import ResponseSummary , StreamingTextResponse
10+ from guidellm .config import settings
1011
1112__all__ = [
1213 "Backend" ,
@@ -129,10 +130,20 @@ async def validate(self):
129130 if not models :
130131 raise ValueError ("No models available for the backend" )
131132
132- async for _ in self .text_completions (
133- prompt = "Test connection" , output_token_count = 1
134- ): # type: ignore[attr-defined]
135- pass
133+ # Use the preferred route defined in the global settings when performing the
134+ # validation request. This avoids calling an unavailable endpoint (ie
135+ # /v1/completions) when the deployment only supports the chat completions
136+ # endpoint.
137+ if settings .preferred_route == "chat_completions" :
138+ async for _ in self .chat_completions ( # type: ignore[attr-defined]
139+ content = "Test connection" , output_token_count = 1
140+ ):
141+ pass
142+ else :
143+ async for _ in self .text_completions ( # type: ignore[attr-defined]
144+ prompt = "Test connection" , output_token_count = 1
145+ ):
146+ pass
136147
137148 await self .reset ()
138149
You can’t perform that action at this time.
0 commit comments