Commit 9d8e083
fix: only pass dimensions when explicitly configured in embedding config (AstrBotDevs#6432)
* fix: only pass dimensions param when explicitly configured
Models like bge-m3 don't support the dimensions parameter in the
embedding API, causing HTTP 400 errors. Previously dimensions was
always sent with a default value of 1024, even when the user never
configured it. Now dimensions is only included in the request when
embedding_dimensions is explicitly set in provider config.
Closes AstrBotDevs#6421
Signed-off-by: JiangNan <1394485448@qq.com>
* fix: handle invalid dimensions config and align get_dim return
- Add try-except around int() conversion in _embedding_kwargs to
gracefully handle invalid embedding_dimensions config values
- Update get_dim() to return 0 when embedding_dimensions is not
explicitly configured, so callers know dimensions weren't specified
and can handle it accordingly
- Both methods now share consistent logic for reading the config
Signed-off-by: JiangNan <1394485448@qq.com>
* fix: improve logging for invalid embedding_dimensions configuration
---------
Signed-off-by: JiangNan <1394485448@qq.com>
Co-authored-by: Soulter <905617992@qq.com>1 parent 9ffb0bd commit 9d8e083
1 file changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | | - | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
59 | 73 | | |
60 | 74 | | |
61 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
62 | 83 | | |
63 | 84 | | |
64 | 85 | | |
| |||
0 commit comments