mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-11 05:38:38 +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. |
||
---|---|---|
.. | ||
0ae34c89b6e4a390a6d7437fba5461180aad57ec74f4e5304be120169a1cd388.json | ||
0e78fbca78d233a94753005520625d54a7bd16e05fd6b33bab07b9c2f469a9ef.json | ||
1f6d321493b7bf855855d38dbef8c581935e1d8f97cf5481c557ebbf844afd9d.json | ||
4c850542629354d2336777bde2099940377f2efd6f0e3c51987255ef16a99e09.json | ||
5b39d8cb44b4a4399b887ba62308f8609deff3c14edf05708c0f1077463b7526.json | ||
5be28ca887d2ca23ba08fecd458cda9a1db6867e2a6ed80708ad0cbd6f5c009b.json | ||
5c675ad22eab85b21c7b36b26423c7571ac68379eef5789c9a8cd13e1a599918.json | ||
5df158d1e0e7f24f8d3230d00b1832d409e127907b1bd07716425145f75102d9.json | ||
6f6c8ca88dbd1f0c616848f2e6ef40bfea13afa98f87a2df8145ca96ddb5e006.json | ||
7f1fb35b3ab8fe247c03b7a174f67c86959732cacaabd8ee84d34f12032c2129.json | ||
9d61324884278d4035c81d34863bd0b18016bab10b1efca5490d34e557bdc9bc.json | ||
17a90a49f33ae82dc70db484f315dd58b0dd6da5b76535c62d3b5c20e48d1dda.json | ||
19d738001b87765857305c6995409d1a54b91b23f94e7ab538a577ddd319c3a0.json | ||
35c722ed1c6cecf86ed7026f5d8048728d0a1343b37a06233cc48f6486d0d95c.json | ||
53d9f79b0066ac4a37f203a5588a12f4033313d74d0810dfdf70aeb9ac440a59.json | ||
63bf3a76e7ada61c29ce4132b3636e111a78e53422d7a47e444a5d609fc4483f.json | ||
78dba4c370dc7c93406ce0847c3d945073f98301d81950e72028bdcfa22fdfda.json | ||
80be3ad4a8bc5983094b5f712c1bf8eb05e3cb98dde1370819ac033811283064.json | ||
247c00c390afb9fa9fd1790cabecc88adff887ec5c2a9d49b3115805b515954f.json | ||
633a5b177494e320cb0e15d723c5687fe8959debb689c298b0718cf071eb2cc2.json | ||
727e2da1e464bd1edcb41565bf3fa971dbae675ac218c451a293f4efc15cd5b6.json | ||
3588d2c7b741847f4f07f527ff0d7afa0d11207c58eaabc414323f380572dd62.json | ||
7502d8c2ba4cb3e4ecc0003b2d827c1200ce62670b424b29c26d2bbbeabb247f.json | ||
8454af02b39e73fd4123e05d51a50724830e315ecf6c196b4f2aee555d132c48.json | ||
9220bdd52ca4510614c52db4dcdbc3be2ae6a4e801e56a3db976f5753a08d03e.json | ||
88892aa1343092946cfdaace631e05ee9230b034b70a6e50bb9c55b5b8ab1c28.json | ||
92596e5cbb8cf4e33d28cf07e33aab08318f508f2097f81929851974697cd2ec.json | ||
179626319f276486be765c5d3a237076760192c684a4e9496cee7b66e200e317.json | ||
839362810c9b504b023c11e14efa310cf8c55cf7c776f36433047527cfdddb63.json | ||
6630195832cdccbc039e90590481b5afdcb8d0fea0f881fc8cc712357c17eb13.json | ||
a8034a1147bb39677e60cd1804dc7a5c2c552c5a3751a3913b013d4c0922db43.json | ||
b0be0d3f9870424b00724b15a3ac4f60c10f39afeb9fcbe5445c96c224055799.json | ||
b6bc68184c3b2bab4f827461d6b263c74a34ced3662fdd4ba1439f8070944612.json | ||
be2fda4e2f17acb6ab86f267ddc4e84c140b5101e491e776fc3a184543351a4f.json | ||
c8a9544e714493d70296f7aa955f78b87cc9f5a404b5636f4ceabd96fbe87491.json | ||
c09b8277bfed7446b23d3b14501e89a7ec122b3bd452ef86015e6810caf8deb0.json | ||
c911d10a0d16014080dba8862c88fd1c011641763906e87e5c5ed599ef6d2c89.json | ||
cc652ca1b115410066ebe33523124e7f7015fd7e796253dafab8707417b70964.json | ||
deaa531e1904ebcf4323861c58c2d6af9d90a49ae0ac10b62e259b9d4addec36.json | ||
e3bf59d654d18af5cb4de36799c3259be06d9ffb4d2adcdd4d912b1aec1eb5a1.json | ||
e8ec86761210ba03d68f6408582e143f5959b35a839d869e1d7ff56227594898.json | ||
e465a4a9fcc9342d0eb0776c2c5946d2c0196df6e9de64ea58ee0fc9b2ce81a3.json | ||
e810d124eb76fe74bd00df69a772f4b5283bdb3630655de5449cbd2abb252985.json | ||
f2d32531f5086e8870e6f9485b88c89ce133305244c4a5e080fef9f9b461df29.json | ||
f6fb040653a592f92088f3ec5403d40b96167ab7f0389352e1d54c01325a0918.json | ||
f45e3265280a46922ec96cfd8c0c75896fb415ffd17417b9a8470834cf07a4eb.json |