What happened?
We use pi with a proxy for the LLM providers, by supplying a custom streamFn when creating the agent. This works for the normal LLM calls, but compaction fails. It appears that compaction does not call streamFn but rather calls createSimple directly, which bypasses our proxy.
The correct thing to do, I think, would be to call streamFn in the compact logic as well.
Steps to reproduce
- Create an
Agent with a custom streamFn.
- Do not supply an API key for any of the model providers.
- Converse with agent until you hit compaction.
- Compaction fails because it tries to call the model provider directly and we don't have the api key for them.
Expected behavior
Compaction should use our custom streamFn so it goes through our proxy which attaches the API key.
Version
0.70.6
What happened?
We use pi with a proxy for the LLM providers, by supplying a custom
streamFnwhen creating the agent. This works for the normal LLM calls, but compaction fails. It appears that compaction does not callstreamFnbut rather callscreateSimpledirectly, which bypasses our proxy.The correct thing to do, I think, would be to call
streamFnin the compact logic as well.Steps to reproduce
Agentwith a customstreamFn.Expected behavior
Compaction should use our custom
streamFnso it goes through our proxy which attaches the API key.Version
0.70.6