* llms/openai: sanitize HTTP errors to prevent API key exposure (#1393)
Fix security issue where context deadline errors could expose API keys and
sensitive request details in error messages. Added sanitizeHTTPError function
to detect context timeouts and network errors, then return generic error
messages without exposing sensitive information.
Changes:
- Added sanitizeHTTPError() function to sanitize HTTP client errors
- Updated chat.go to use sanitizeHTTPError() for http.Do() errors
- Updated embeddings.go to use sanitizeHTTPError() for http.Do() errors
- Added comprehensive test cases to prevent regression
* agents: fix ChainCallOption silent failure (#1416)
Fix issue where ChainCallOption parameters were silently ignored by Executor.Call() and Agent implementations.
Changes:
- Updated Agent.Plan() interface signature to accept variadic ChainCallOption parameters
- Updated Executor.Call() to accept and propagate options to Agent.Plan()
- Updated Executor.doIteration() to propagate options through the chain
- Updated OneShotZeroAgent.Plan() to accept and pass options to chains.Predict()
- Updated ConversationalAgent.Plan() to accept and pass options to chains.Predict()
- Updated OpenAIFunctionsAgent.Plan() to accept and pass options to LLM.GenerateContent()
- Exported GetLLMCallOptions() function for option conversion (was getLLMCallOptions)
- Updated test mock to match new Agent interface signature
Now users can pass LLM configuration options (temperature, max tokens, etc.) through executors to agents.
* agents: fix handling of observation suffix in tool inputs
Add test coverage to ensure the executor properly trims nObservation:
suffix from tool inputs before passing them to tools. This prevents
tools from receiving malformed input that includes the observation
marker.
- Add TestExecutorTrimsObservationSuffix to verify trimming behavior
- Add test case in MRKL output parser for action inputs with observation suffix
- Add tools field to testAgent to support tool testing
---------
Co-authored-by: Travis Cline <travis.cline@gmail.com>
* feat: change Executor to *Executor
* docs: add deprecated comment to agents.Initialize
* feat: change CreationOptions to Options in agents
* feat: change CreationOption type to Option in agents