Skip to content

When using RAG or Multi-Agent features with llama models the script stops replying without meeting the termination condition or errors #4422

Closed as not planned
@gianx89

Description

@gianx89

Hi to all! I'm using Autogen to develop a RAG system, even better if Multi-Agent. I must use open source, preferably local models, like llama 3.1 or llama 3.2 . I'm using ChromaDB as my vector database.

I'm developing a system that can write a Comic Book Story with a specific format. There is writer or teams of writers that writes the story, a critic or a team of critics that gives advices on how to improve the story a manager or team of managers that incorporates this suggestions. When the story is deemed satisfactory, an agent writes "TERMINATE".

I don't have any issues using OpenAI APIs and models like GPT-3.5 Turbo or GPT-4. However, when working with open-source or local models, I encounter unpredictable behaviors.

The agents starts talking:

==============================
Starting Chat using model:  meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo
==============================
Trying to create collection.
2024-11-28 16:51:13,962 - autogen.agentchat.contrib.retrieve_user_proxy_agent - INFO - Use the existing collection `autogen-docs`.
2024-11-28 16:51:14,089 - autogen.agentchat.contrib.retrieve_user_proxy_agent - INFO - Found 36 chunks.
VectorDB returns doc_ids:  [['45f5db71']]
Adding content of doc 45f5db71 to context.
P0 (to chat_manager):

You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the
context provided by the user.
If you can't answer the question with or without the current context, you should reply exactly `UPDATE CONTEXT`.
You must give as short an answer as possible.

User's question is: 
[INST]As P0, I will initiate the discussion. I request Team S to create a story for a comic that contains exactly 10 panels.
The story must adhere to the following guidelines:

Characters: The story should feature exactly 2 characters:
    - Character 1: An experienced superhero comic writer and professor.
    - Character 2: A new writer who is learning to create superhero comic book stories.

Story Subject:
    - The main character (professor) teaches the new writer the art of crafting superhero comic book stories.
    - The plot should reflect the dynamics of this mentor-student relationship and highlight creative and technical aspects of superhero storytelling.
Note: Ensure the story is engaging, concise, and evenly distributed across the 10 panels.

NEXT: S0.[/INST]


Context is: Many authors began their love of storytelling by reading comics as children. Everything from The Beano and Marvel comics, to manga and graphic novels, all play a part in enriching the minds of the young and the young-at-heart.


...


--------------------------------------------------------------------------------

Next speaker: S0

Truncated 2957 tokens. Number of tokens reduced from 3366 to 409
S0 (to chat_manager):

TITLE: The Art of Superhero Storytelling
ABSTRACT: A young writer learns the art of crafting superhero comic book stories from an experienced professor.

PROTAGONISTS: 
- Professor Thompson: An experienced superhero comic writer and professor.
- Alex: A new writer who is learning to create superhero comic book stories.

PANEL START 1
 IMAGE_DESCRIPTION: Professor Thompson's office with shelves of comic books and a desk with writing materials.
 IMAGE_DIALOGUES: 
Professor Thompson: "Welcome, Alex. I see you're interested in writing superhero comics."
Alex: "Yes, Professor. I've always been a fan."
PANEL END 1

PANEL START 2
 IMAGE_DESCRIPTION: Professor Thompson holds up a comic book.
 IMAGE_DIALOGUES: 
Professor Thompson: "The key to a great superhero story is a compelling character arc."
PANEL END 2

PANEL START 3
 IMAGE_DESCRIPTION: Alex scribbles notes as Professor Thompson lectures.
 IMAGE_DIALOGUES: 
Professor Thompson: "You must balance action and dialogue to keep the reader engaged."
Alex: "That makes sense, but how do I do that?"
PANEL END 3

PANEL START 4
 IMAGE_DESCRIPTION: Professor Thompson shows Alex a split-screen of a comic panel.
 IMAGE_DIALOGUES: 
Professor Thompson: "Panel layout is crucial. It guides the reader's eye through the story."
PANEL END 4

PANEL START 5
 IMAGE_DESCRIPTION: Alex and Professor Thompson sit at a table with a large sheet of paper and pencils.
 IMAGE_DIALOGUES: 
Professor Thompson: "Now, let's create a story together. What's your superhero's origin story?"
Alex: "Uh, I'm not sure..."
PANEL END 5

PANEL START 6
 IMAGE_DESCRIPTION: Professor Thompson smiles as Alex starts to brainstorm.
 IMAGE_DIALOGUES: 
Professor Thompson: "That's it! The origin story is the heart of any superhero tale."
PANEL END 6

PANEL START 7
 IMAGE_DESCRIPTION: Alex and Professor Thompson work on the comic script together.
 IMAGE_DIALOGUES: 
Alex: "I think I'm getting the hang of this!"
Professor Thompson: "You are! Just remember to keep it concise."
PANEL END 7

PANEL START 8
 IMAGE_DESCRIPTION: Alex and Professor Thompson review the comic script.
 IMAGE_DIALOGUES: 
Professor Thompson: "Now, let's add some action scenes to keep the reader engaged."
Alex: "I've got an idea!"
PANEL END 8

PANEL START 9
 IMAGE_DESCRIPTION: Alex and Professor Thompson work on the comic's action scenes.
 IMAGE_DIALOGUES: 
Alex: "This is so much fun! I never realized how much work went into a comic."
Professor Thompson: "That's the beauty of it – collaboration and creativity."
PANEL END 9

PANEL START 10
 IMAGE_DESCRIPTION: Alex holds up the finished comic book, beaming with pride.
 IMAGE_DIALOGUES: 
Alex: "Thank you, Professor Thompson. I couldn't have done it without you."
Professor Thompson: "You're welcome, Alex. You're a natural."
PANEL END 10

NEXT: C0

--------------------------------------------------------------------------------

Next speaker: C0

Truncated 3204 tokens. Number of tokens reduced from 4022 to 818
C0 (to chat_manager):

NEXT: C1

--------------------------------------------------------------------------------

Next speaker: C1

Truncated 3204 tokens. Number of tokens reduced from 4026 to 822
C1 (to chat_manager):

The story is off to a good start. I like how Professor Thompson is guiding Alex through the basics of superhero storytelling.

However, I think the pacing could be improved. Some panels feel a bit rushed, such as panel 5 where Alex is asked to come up with an origin story on the spot.

I'd like to see more development of the mentor-student relationship and more exploration of the creative process.

NEXT: C0

--------------------------------------------------------------------------------

Next speaker: C0

Truncated 3204 tokens. Number of tokens reduced from 4112 to 908
C0 (to chat_manager):

I agree with C1's assessment. The story has potential, but the pacing and character development need improvement. I suggest adding more panels to show the progression of Alex's learning and the mentor-student relationship.

Specifically, I'd like to see more of Professor Thompson's teaching style and how Alex responds to it. Perhaps we could add a panel where Alex shares their own ideas and Professor Thompson provides feedback.

Additionally, let's explore the creative process more deeply. What are the challenges of writing a superhero story? How does Professor Thompson help Alex overcome these challenges?

NEXT: S0

--------------------------------------------------------------------------------

Next speaker: S0

Truncated 3204 tokens. Number of tokens reduced from 4229 to 1025
S0 (to chat_manager):

TITLE: The Art of Superhero Storytelling
ABSTRACT: A young writer learns the art of crafting superhero comic book stories from an experienced professor.

PROTAGONISTS: 
- Professor Thompson: An experienced superhero comic writer and professor.
- Alex: A new writer who is learning to create superhero comic book stories.

PANEL START 1
 IMAGE_DESCRIPTION: Professor Thompson's office with shelves of comic books and a desk with writing materials.
 IMAGE_DIALOGUES: 
Professor Thompson: "Welcome, Alex. I see you're interested in writing superhero comics."
Alex: "Yes, Professor. I've always been a fan."
PANEL END 1

PANEL START 2
 IMAGE_DESCRIPTION: Professor Thompson holds up a comic book.
 IMAGE_DIALOGUES: 
Professor Thompson: "The key to a great superhero story is a compelling character arc."
PANEL END 2

PANEL START 3
 IMAGE_DESCRIPTION: Alex scribbles notes as Professor Thompson lectures.
 IMAGE_DIALOGUES: 
Professor Thompson: "You must balance action and dialogue to keep the reader engaged."
Alex: "That makes sense, but how do I do that?"
PANEL END 3

PANEL START 4
 IMAGE_DESCRIPTION: Professor Thompson shows Alex a split-screen of a comic panel.
 IMAGE_DIALOGUES: 
Professor Thompson: "Panel layout is crucial. It guides the reader's eye through the story."
PANEL END 4

PANEL START 5
 IMAGE_DESCRIPTION: Alex and Professor Thompson sit at a table with a large sheet of paper and pencils.
 IMAGE_DIALOGUES: 
Professor Thompson: "Now, let's brainstorm together. What kind of superhero would you like to create?"
Alex: "I've always wanted to write about a hero with the power of teleportation."
PANEL END 5

PANEL START 6
 IMAGE_DESCRIPTION: Professor Thompson smiles as Alex starts to brainstorm.
 IMAGE_DIALOGUES: 
Professor Thompson: "That's a great start! But how do you plan to make this hero relatable to readers?"
Alex: "Hmm, I'm not sure..."
PANEL END 6

PANEL START 7
 IMAGE_DESCRIPTION: Professor Thompson provides feedback as Alex shares their ideas.
 IMAGE_DIALOGUES: 
Professor Thompson: "I like where you're going with this, but what if we add a personal stake to the hero's teleportation power?"
Alex: "Like what?"
PANEL END 7

PANEL START 8
 IMAGE_DESCRIPTION: Alex's eyes light up as they start to see the potential of their hero.
 IMAGE_DIALOGUES: 
Professor Thompson: "Exactly! Now we're getting somewhere. The hero's power is not just a tool, but a reflection of their inner struggle."
Alex: "That's amazing!"
PANEL END 8

PANEL START 9
 IMAGE_DESCRIPTION: Professor Thompson hands Alex a script with notes and feedback.
 IMAGE_DIALOGUES: 
Professor Thompson: "Now it's your turn to write a scene. Don't worry about getting it perfect, just let your creativity flow."
Alex: "Thanks, Professor. I'll get right on it!"
PANEL END 9

PANEL START 10
 IMAGE_DESCRIPTION: Alex sits at their desk, writing furiously as Professor Thompson looks on with a proud smile.
 IMAGE_DIALOGUES: 
Alex: "This is it! I think I'm finally getting the hang of it!"
Professor Thompson: "That's the spirit, Alex! You're well on your way to becoming a great superhero writer."
PANEL END 10

NEXT: P0

--------------------------------------------------------------------------------

Next speaker: P0

Truncated 3520 tokens. Number of tokens reduced from 4954 to 1434
==============================
Chat Ends
==============================

Process finished with exit code 0

The chats ends without error but abruptly, without meeting the termination condition. Sometimes, very rarely, I get the right results and the chat ends with "TERMINATE" string.

Any suggestions? I can't share all the code at the moment, but I can reply with snippets of it.

P.S.
The max_rounds are pretty high (100)

Metadata

Metadata

Assignees

Labels

0.2Issues which are related to the pre 0.4 codebaseragretrieve-augmented generative agents

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions