WrapModel returns model unchanged when debug recording is disabled, or a debug wrapper when a service is available.
( model fantasy.LanguageModel, svc *Service, opts RecorderOptions, )
| 23 | // WrapModel returns model unchanged when debug recording is disabled, or a |
| 24 | // debug wrapper when a service is available. |
| 25 | func WrapModel( |
| 26 | model fantasy.LanguageModel, |
| 27 | svc *Service, |
| 28 | opts RecorderOptions, |
| 29 | ) fantasy.LanguageModel { |
| 30 | if model == nil { |
| 31 | panic("chatdebug: nil LanguageModel") |
| 32 | } |
| 33 | if svc == nil { |
| 34 | return model |
| 35 | } |
| 36 | return &debugModel{inner: model, svc: svc, opts: opts} |
| 37 | } |
| 38 | |
| 39 | type attemptSink struct { |
| 40 | mu sync.Mutex |
no outgoing calls