Commit e2bc89f
committed
Reduce finish_reason reliance
Non-auto tool choices will result in a finish_reason of "stop" rather than "tool_calls". The current code assumes "stop" means there are no tool calls to be made when this isn't true. Instead, it should simply check for any available tool calls.
Alongside, the last message in a chat completion stream isn't guaranteed to have the finish_reason. Instead we should check for any reasons to stop as we collect chunks and then use that at the end.1 parent dd43d73 commit e2bc89f
File tree
2 files changed
+12
-22
lines changed- mcp_bridge/openai_clients
2 files changed
+12
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
125 | 118 | | |
126 | 119 | | |
127 | 120 | | |
128 | | - | |
| 121 | + | |
129 | 122 | | |
| 123 | + | |
| 124 | + | |
130 | 125 | | |
131 | 126 | | |
132 | 127 | | |
| |||
149 | 144 | | |
150 | 145 | | |
151 | 146 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 147 | + | |
161 | 148 | | |
162 | 149 | | |
163 | 150 | | |
164 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
165 | 155 | | |
166 | 156 | | |
167 | 157 | | |
| |||
0 commit comments