Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeeAgent with granite LLM uses BeeAssistantPrompt vs. GraniteBeeAssistantPrompt #219

Closed
michael-desmond opened this issue Dec 3, 2024 · 3 comments · Fixed by #223
Closed
Assignees
Labels
bug Something isn't working

Comments

@michael-desmond
Copy link
Contributor

michael-desmond commented Dec 3, 2024

Describe the bug
I was noticing that BeeAgent when configured with a granite llm uses the standard BeeAssistantPrompt which conflicts with the granite system prompt and causes the llm to perform poorly. The offending code is here:

text: (this.input.templates?.assistant ?? BeeAssistantPrompt).render({

A fairly simple fix is to conditionally choose a default AssistantPrompt before rendering i.e.

const template = (this.input.llm.modelId.includes("granite"))?GraniteBeeAssistantPrompt: BeeAssistantPrompt;

But this is not the most elegant solution imo because it introduces more ad hoc checks into the agent.

Ideally we could move the rendering of the assistant message into the runner hierarchy. The renders method seems to be the most appropriate spot.

https://github.com/i-am-bee/bee-agent-framework/blob/fd942ae0116893b9452530c305e0053bb83f5578/src/agents/bee/runners/default/runner.ts#L256C17-L256C28

However the renders method is introduced on the DefaultRunner as opposed to the BaseRunner which is the type maintained by the BeeAgent.

To Reproduce
Steps to reproduce the behavior:

  1. Create a BeeAgent with granite and breakpoint line 130.
  2. The BeeAssistantPrompt is applied when rendering the assistant prompt.

Expected behavior
The GraniteBeeAssistantPrompt should be applied when rendering the assistant prompt.

Set-up:

  • Bee version: 0.0.47
  • Model provider: Ollama
@michael-desmond michael-desmond added the bug Something isn't working label Dec 3, 2024
@michael-desmond
Copy link
Contributor Author

@Tomas2D Can u give an opinion on this one when you get a chance.

@Tomas2D
Copy link
Contributor

Tomas2D commented Dec 4, 2024

Good catch!

Fixed in #223

Tomas2D added a commit that referenced this issue Dec 4, 2024
@Tomas2D
Copy link
Contributor

Tomas2D commented Dec 4, 2024

Released in v0.0.48

matiasmolinas pushed a commit to matiasmolinas/bee-agent-framework that referenced this issue Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants