* 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.
test: improve test resilience with better HTTP recording handling
Add hasExistingRecording helper to detect available recordings and skip tests
gracefully when recordings are unavailable. Replace generic credential checks
with specific recording validation and provide clear error messages.
* 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>
* all: add broad httprr coverage, update dependencies, organize go.mod file, bump to 1.23
update go version to 1.23
add lots of test coverage via httprr recordings
update dependencies and organize go.mod
add testutil/testctr which helps work around a testcontainers-go+colima bug
expand the huggingface implementation and tests
expand capabilities of the ollama package
* examples: update examples, clean up module declarations
- Fix and relax lint rules (for now)
- Clean up and fix module declarations
- Add .gitattributes to mark go.sum as binary
* ci: separate and enhance CI workflows
- Split example builds into dedicated workflow
- Add comprehensive test coverage reporting
- Improve CI structure with matrix testing
- Add race condition testing
- Add automated PR coverage comments
* test: improve test reliability and agent message handling
- Simplify MRKL agent test to use basic math calculation
- Update OpenAI functions agent to use ToolChatMessage
- Add proper environment checks for Zep integration tests
* agents: fix issue in tool call handling for openai function agent