15 Commits

Author SHA1 Message Date
Travis Cline db2a947ba4 agents: fix ChainCallOption silent failure (#1420)
* 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.
2025-10-19 17:03:11 -07:00
xiazemin c2f9ad7f34 agents: Add more robust response handling to executor.go (#1316)
* 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>
2025-06-29 01:09:12 +02:00
Augustinas Malinauskas 7b5d90adbb agents: GetTools added to Agent interface (#831)
* feat: serpapi api key options

* feat: agent tools interface
2024-05-11 19:33:36 -04:00
Hao Chun Chang 4746a5d89f Improvements on agents package API (#551)
* 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
2024-03-19 23:24:48 +00:00
h3l 8761cce5e5 support agent finish callback (#476)
add agent finish callback

Co-authored-by: lvzhong <lvzhong@bytedance.com>
2024-01-02 23:40:28 -08:00
chyroc 55f772c21a Docs: fix comment typo (#442)
* Docs: fix comment typo

* docs: a llm -> an LLM

---------

Co-authored-by: Travis Cline <travis.cline@gmail.com>
2023-12-20 19:57:37 +00:00
Aksel 543f504f47 agents: add parser error handler (#345)
* agents: add ParserErrorHandler

* chains: return result when error in chain

* agents: fix lint
2023-12-04 22:38:29 -08:00
Travis Cline c5b84faa54 callbacks: Include context 2023-08-25 19:14:02 -07:00
FluffyKebab b2dee18c4b callbacks: nolint forbidigo in logger 2023-08-25 19:00:43 -07:00
FluffyKebab 9863d13b4e reduce cylop in executor 2023-08-25 19:00:43 -07:00
FluffyKebab 03ad4b7799 add callbacks to tools, vectorsores and agents 2023-08-25 19:00:21 -07:00
FluffyKebab 44eb35c38a agents: add memory to executor chain and add test to conversational 2023-06-27 16:16:56 +02:00
FluffyKebab e723130480 agents: fix lint 2023-06-24 18:38:49 +02:00
FluffyKebab ad07fe6904 agents: fix bug and add option to return intermaidate steps 2023-06-24 17:59:14 +02:00
FluffyKebab 2cd0d13ccf agents: refactor options 2023-06-07 19:24:38 +02:00