ClearPreviousResponseID returns a clone of providerOptions with PreviousResponseID cleared on the OpenAI Responses options. The original providerOptions is not modified.
(providerOptions fantasy.ProviderOptions)
| 129 | // PreviousResponseID cleared on the OpenAI Responses options. The original |
| 130 | // providerOptions is not modified. |
| 131 | func ClearPreviousResponseID(providerOptions fantasy.ProviderOptions) fantasy.ProviderOptions { |
| 132 | cloned := maps.Clone(providerOptions) |
| 133 | if cloned == nil { |
| 134 | return fantasy.ProviderOptions{} |
| 135 | } |
| 136 | |
| 137 | entry, ok := cloned[fantasyopenai.Name] |
| 138 | if !ok { |
| 139 | return cloned |
| 140 | } |
| 141 | options, ok := entry.(*fantasyopenai.ResponsesProviderOptions) |
| 142 | if !ok || options == nil { |
| 143 | return cloned |
| 144 | } |
| 145 | optionsClone := *options |
| 146 | optionsClone.PreviousResponseID = nil |
| 147 | cloned[fantasyopenai.Name] = &optionsClone |
| 148 | return cloned |
| 149 | } |
| 150 | |
| 151 | // extractResponseID extracts the OpenAI Responses API response ID from provider |
| 152 | // metadata. Returns an empty string if no OpenAI Responses metadata is present. |