mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-10 21:34:36 +00:00
# What does this PR do? ## Test Plan # What does this PR do? ## Test Plan # What does this PR do? ## Test Plan Completes the refactoring started in previous commit by: 1. **Fix library client** (critical): Add logic to detect Pydantic model parameters and construct them properly from request bodies. The key fix is to NOT exclude any params when converting the body for Pydantic models - we need all fields to pass to the Pydantic constructor. Before: _convert_body excluded all params, leaving body empty for Pydantic construction After: Check for Pydantic params first, skip exclusion, construct model with full body 2. **Update remaining providers** to use new Pydantic-based signatures: - litellm_openai_mixin: Extract extra fields via __pydantic_extra__ - databricks: Use TYPE_CHECKING import for params type - llama_openai_compat: Use TYPE_CHECKING import for params type - sentence_transformers: Update method signatures to use params 3. **Update unit tests** to use new Pydantic signature: - test_openai_mixin.py: Use OpenAIChatCompletionRequestParams This fixes test failures where the library client was trying to construct Pydantic models with empty dictionaries. The previous fix had a bug: it called _convert_body() which only keeps fields that match function parameter names. For Pydantic methods with signature: openai_chat_completion(params: OpenAIChatCompletionRequestParams) The signature only has 'params', but the body has 'model', 'messages', etc. So _convert_body() returned an empty dict. Fix: Skip _convert_body() entirely for Pydantic params. Use the raw body directly to construct the Pydantic model (after stripping NOT_GIVENs). This properly fixes the ValidationError where required fields were missing. The streaming code path (_call_streaming) had the same issue as non-streaming: it called _convert_body() which returned empty dict for Pydantic params. Applied the same fix as commit 7476c0ae: - Detect Pydantic model parameters before body conversion - Skip _convert_body() for Pydantic params - Construct Pydantic model directly from raw body (after stripping NOT_GIVENs) This fixes streaming endpoints like openai_chat_completion with stream=True. The streaming code path (_call_streaming) had the same issue as non-streaming: it called _convert_body() which returned empty dict for Pydantic params. Applied the same fix as commit 7476c0ae: - Detect Pydantic model parameters before body conversion - Skip _convert_body() for Pydantic params - Construct Pydantic model directly from raw body (after stripping NOT_GIVENs) This fixes streaming endpoints like openai_chat_completion with stream=True. |
||
---|---|---|
.. | ||
0c8984700e40bf0d44833f90953e5342f125d914309bccba486d9f57c23b9859.json | ||
1b2720589d2a4273b5eb2c06b50ab45674040195c15013c9ea43bc6331e1a831.json | ||
1f2b4e36bf72ef4b5adab16e5b6b30fdade0ca46dcc775a2d170195a758d9fee.json | ||
3e5ea35cb3dc92835d230456b6e2fc61593f964148d6c05df5c4a387a5389e6b.json | ||
5a16e5732aeabbf64fc2721959a9833d33148a7d49a939210b0da53d40e53335.json | ||
5afa13a103607d7e6458016c7c84832daecccd9cfcb94b24b8ce3464e48b2a2a.json | ||
6de6d1ebc3128dfaba1efe654ca1453f12cd31ce2e294d20868c0c498b7d9136.json | ||
9ebe1e04fc3a8d41f88992428a7c99669c7e19b3d551090eb6bec83b33de2a18.json | ||
37c094dfb2c0a88f8d8cd68a9517b7ce93cff4581d3f5249617a55b365599a7e.json | ||
93eb5947d1f24d3aad6cd40204dd277754033d4eba8d41e50977b524184c1d35.json | ||
114eab4f9f8f5acb824eb2594d1450caca195734abc0715c4f75b7053aa1bada.json | ||
171c4dcb3dc848196f5d7fd87efd4626e70673c405ae1cd72b8dd0617104263e.json | ||
263ddc08771b6726e6c988cc4ff60a0061866cc1ae63a49e6ec5874d62acf3e3.json | ||
855fb7d6601d4bbe1beeb74b3da3de34f36ecb84970631f04f70062d5f43aa19.json | ||
3725e37b2450659b259d104b35ef8a09d5dbf44e43d5eee1fcfc9bff409a9152.json | ||
6510fee16a2c4491ea1c83ef31a36b54907de9b3655b5f8e1adc5dd2eb08dc63.json | ||
79442c9aaf43303f82a227a0f3c1716f5132823c397f27d193ea8ff549d267ee.json | ||
233893abb269e245715747a638dcca6dcf2a71a12dc2954835fdc0d17cb7520e.json | ||
3695037e405c8031c024e4817552dabe8f25ee8b0cf3ecccee78c1cce4420761.json | ||
12879558aac0a5023adf0a5ca8de1d1ce52dd4e1dfce65117be03f11db3e617a.json | ||
aa20023c358a0dc718355082cc244a231426700a772b8dc64abf05d8b126a736.json | ||
b52a054b314c8b42634c4a9ef76280591f73cf26c00b7308dde7d19a1ced016c.json | ||
c07b01fe99467efcfa99f6ac9c60acc212cf2ac3bdd4192aabb5f98359236572.json | ||
cb1ddd850e8622c70aa5bd0839d408c00a8b4db2129641e462e4de1bca23a48d.json |