IsReasoningModel reports whether a model ID follows OpenAI reasoning model naming conventions.
(modelID string)
| 202 | // IsReasoningModel reports whether a model ID follows OpenAI reasoning model |
| 203 | // naming conventions. |
| 204 | func IsReasoningModel(modelID string) bool { |
| 205 | if len(modelID) < 2 || modelID[0] != 'o' { |
| 206 | return false |
| 207 | } |
| 208 | |
| 209 | index := 1 |
| 210 | for index < len(modelID) && modelID[index] >= '0' && modelID[index] <= '9' { |
| 211 | index++ |
| 212 | } |
| 213 | if index == 1 { |
| 214 | return false |
| 215 | } |
| 216 | |
| 217 | if index == len(modelID) { |
| 218 | return true |
| 219 | } |
| 220 | return modelID[index] == '-' || modelID[index] == '.' |
| 221 | } |
| 222 | |
| 223 | func boolPtrOrDefault(value *bool, def bool) *bool { |
| 224 | if value != nil { |
no outgoing calls