Commit 2ed2486
committed
fix(a2a): drop cached agent vectors whose dimension no longer matches the query
When the configured agent_search_embedding_model or a router fallback
switches to a model with a different embedding dimension, the query
vector shape stops matching cached agent vectors. cosine_similarity uses
zip(..., strict=True), so ranking raised ValueError outside the
try/except that treats embedding failures as AgentSearchEmbeddingFailed.
Because the cache never dropped the old vectors, every subsequent
GET /v1/agents?query= and agent_search MCP call returned 500 until the
worker restarted.
After embedding the query, filter the cache to only vectors of the same
dimension and re-embed any agent texts that got evicted.1 parent e9cc9c9 commit 2ed2486
2 files changed
Lines changed: 29 additions & 2 deletions
File tree
- litellm/proxy/agent_endpoints
- tests/test_litellm/proxy/agent_endpoints
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
168 | 182 | | |
169 | 183 | | |
170 | | - | |
| 184 | + | |
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
150 | 163 | | |
151 | 164 | | |
152 | 165 | | |
| |||
0 commit comments