{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Crafting an Interactive Narrative with MiniAutoGen\n",
    "This example demonstrates how MiniAutoGen can be utilized to create an interactive, multi-character narrative set in a Parisian café. It showcases the integration of advanced language models, custom templates, and dynamic agent interactions to build an engaging story.\n",
    "\n",
    "### Setting Up the Environment\n",
    "First, ensure the MiniAutoGen library and dependencies are installed. Use the dotenv library for environment variable management."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from dotenv import load_dotenv\n",
    "\n",
    "load_dotenv()\n",
    "api_key = os.getenv('OPENAI_API_KEY')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Initializing LLM Clients\n",
    "## Create clients for interacting with OpenAI's models and LiteLLM.\n",
    "\n",
    "from miniautogen.llms.llm_client import LiteLLMClient\n",
    "\n",
    "openai_client = LiteLLMClient(model='gpt-3.5-turbo-16k')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from miniautogen.chat.chat import Chat\n",
    "from miniautogen.agent.agent import Agent\n",
    "from miniautogen.chat.chatadmin import ChatAdmin\n",
    "from miniautogen.pipeline.pipeline import Pipeline\n",
    "from miniautogen.pipeline.components.components import (\n",
    "    Jinja2TemplatesComponent, LLMResponseComponent, UserResponseComponent, \n",
    "    AgentReplyComponent, TerminateChatComponent, NextAgentSelectorComponent\n",
    ")\n",
    "\n",
    "# Create Jinja2 template components for narrative and conversation history\n",
    "PROMPT_TEMPLATE_MOVIE_SCENE = \"\"\"\n",
    "# Introduction\n",
    "- You are a character in a movie, as described in the \"Your Character\" section.\n",
    "- You interact in a movie setting, collaborating with other characters to develop a specific scene.\n",
    "\n",
    "# Movie Scene\n",
    "- Scene description: {{chat.context['goal']}}\n",
    "\n",
    "# Your Character\n",
    "- CHARACTER NAME: {{agent.name}}\n",
    "- CHARACTER DESCRIPTION: \n",
    "{{agent.role}}\n",
    "\n",
    "# Scene Characters\n",
    "{% for agent in chat.agentList %}\n",
    "  - {{agent.name}}: {{agent.role}}\n",
    "{% endfor %}\n",
    "\n",
    "# Scene Dynamics\n",
    "- Maintain consistency with the plot and personality of your character.\n",
    "- Your identity: You are {{agent.name}}, keep a clear distinction between yourself and other characters.\n",
    "- Speaker identification: Each line will be preceded by the character's name.\n",
    "\n",
    "# Scene Instructions\n",
    "- Stay true to the scene's objective and tone.\n",
    "- Contribute to the development of the narrative and interactions between characters.\n",
    "\n",
    "# Response Format\n",
    "- Respond ONLY with your character's lines or actions.\n",
    "- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.\n",
    "\"\"\"\n",
    "\n",
    "\n",
    "PROMPT_TEMPLATE_CONVERSATION_HISTORY = \"\"\"\n",
    "CONVERSATION HISTORY:\n",
    "-----------------------------------------------------------------------------------------\n",
    "[\n",
    "  {% for message in messages %}\n",
    "    {\"Sender\": \"{{ message['sender_id'] }}\", \"Content\": \"{{ message['message'] | escape }}\"}{% if not loop.last %}, {% endif %}\n",
    "  {% endfor %}\n",
    "]\n",
    "-----------------------------------------------------------------------------------------\n",
    "\"\"\"\n",
    "\n",
    "jinja_component = Jinja2TemplatesComponent()\n",
    "jinja_component.add_template(PROMPT_TEMPLATE_MOVIE_SCENE, 'system')\n",
    "jinja_component.add_template(PROMPT_TEMPLATE_CONVERSATION_HISTORY, 'user')\n",
    "\n",
    "\n",
    "chat_context = {'goal': '''\n",
    "Title: \"Meeting at Café Parisiense\"\n",
    "In a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\n",
    "Alex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\n",
    "As the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille's heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\n",
    "As the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\n",
    "'''}\n",
    "\n",
    "# Initialize the chat environment and set the context\n",
    "chat = Chat()\n",
    "chat.context = chat_context\n",
    "\n",
    "# Create the pipelines for the different agents\n",
    "pipeline_jinja = Pipeline([jinja_component, LLMResponseComponent(openai_client)])\n",
    "pipeline_admin = Pipeline(\n",
    "    [NextAgentSelectorComponent(), AgentReplyComponent(), TerminateChatComponent()])\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "FIRST_MESSAGE =  \"\"\"\n",
    "On a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\n",
    "\n",
    "The café's tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\n",
    "\n",
    "In this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café's tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\n",
    "\n",
    "While Alex dedicated himself to capturing Camille's essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\n",
    "\n",
    "And so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other's existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\n",
    "\"\"\"\n",
    "\n",
    "json_messages = [\n",
    "    {'sender_id': 'storyteller', 'message': FIRST_MESSAGE},\n",
    "]\n",
    "\n",
    "chat.add_messages(json_messages)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Create and configure agents\n",
    "\n",
    "ALEX = \"\"\"\n",
    "Full Name: Alex Dubois\n",
    "Age: 30 years old\n",
    "Physical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\n",
    "Personality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\n",
    "Background: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\n",
    "\"\"\"\n",
    "\n",
    "JORDAN = \"\"\"\n",
    "Full Name: Jordan Anderson\n",
    "Age: 28 years old\n",
    "Physical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\n",
    "Personality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\n",
    "Background: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\n",
    "\"\"\"\n",
    "\n",
    "CAMILLE = \"\"\"\n",
    "Full Name: Camille Moreau\n",
    "Age: 25 years old\n",
    "Physical Description: An elegant young woman with wavy brown hair that falls softly over her shoulders and bright green eyes. She possesses a natural charm.\n",
    "Personality: Friendly, sweet, and attentive, Camille is known for her hospitality and warm smile. She loves Parisian culture and dreams of exploring the world someday.\n",
    "Background: Camille grew up in Paris and has been working at Café Parisiense since she was a teenager. She is passionate about classical music and aspires to travel and study the arts someday.\n",
    "\"\"\"\n",
    "\n",
    "\n",
    "storyteller = \"\"\"\n",
    "The narrator of this story is a subtle and omniscient presence, guiding the reader through the intricacies of the romance unfolding at the Café Parisiense. With a gentle and engaging voice, the narrator inserts into the events with the grace of a keen observer, bringing forth the romantic and magical atmosphere of the City of Lights.\n",
    "The narrative is like a richly painted canvas, detailing the colors, sounds, and emotions that permeate each scene. It invites us to dive into the psyche of the characters, revealing their deepest thoughts and feelings while simultaneously keeping us suspended in the enchantment of the city of Paris.\n",
    "This narrator acts as a guide, leading us through the sun-drenched cobblestone streets and the tables adorned with fresh flowers at Café Parisiense. It invites us to contemplate the beauty of subtle gestures, stolen glances, and unspoken words that weave the fabric of love and desire among the characters.\n",
    "With a touch of mystery and a healthy dose of romance, the narrator guides us as destiny unfolds at Café Parisiense, where passions intertwine, secrets are revealed, and love blossoms under the radiant light of Paris. Get ready to embark on this enchanting journey, where the pages come to life, and the heart beats in harmony with the sighs of the City of Lights.\n",
    "\"\"\"\n",
    "\n",
    "agente1_data = {\n",
    "    'agent_id': 'ALEX',\n",
    "    'name': 'Alex Dubois',\n",
    "    'role': ALEX}\n",
    "\n",
    "agente2_data = {\n",
    "    'agent_id': 'JORDAN',\n",
    "    'name': 'Jordan Anderson',\n",
    "    'role': JORDAN}\n",
    "\n",
    "agente3_data = {\n",
    "    'agent_id': 'CAMILLE',\n",
    "    'name': 'Camille Moreau',\n",
    "    'role': 'CAMILLE'}\n",
    "\n",
    "agente4_data = {\n",
    "    'agent_id': 'storyteller',\n",
    "    'name': 'storyteller',\n",
    "    'role': 'storyteller'}\n",
    "\n",
    "# Criação de Agentes\n",
    "agent1 = Agent.from_json(agente1_data)\n",
    "agent1.pipeline = pipeline_jinja  # Atribuindo o pipeline ao agente\n",
    "\n",
    "agent2 = Agent.from_json(agente2_data)\n",
    "agent2.pipeline = pipeline_jinja  # Atribuindo o pipeline_llm ao segundo agente\n",
    "\n",
    "agent3 = Agent.from_json(agente3_data)\n",
    "agent3.pipeline = pipeline_jinja  # Atribuindo o pipeline_user ao terceiro agente\n",
    "\n",
    "agent4 = Agent.from_json(agente4_data)\n",
    "agent4.pipeline = pipeline_jinja  # Atribuindo o pipeline_user ao terceiro agente\n",
    "\n",
    "# Adicionando os agentes ao chat\n",
    "chat.add_agent(agent1)\n",
    "chat.add_agent(agent2)\n",
    "chat.add_agent(agent3)\n",
    "chat.add_agent(agent4)\n",
    "\n",
    "# Criação e configuração do ChatAdmin\n",
    "chat_admin = ChatAdmin(\"admin\", \"Admin\", \"admin_role\",\n",
    "                       pipeline_admin, chat, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:miniautogen.chat.chatadmin:Chat Admin started.\n",
      "INFO:miniautogen.chat.chatadmin:Executing round 1\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'role': 'system', 'content': '\\n# Introduction\\n- You are a character in a movie, as described in the \"Your Character\" section.\\n- You interact in a movie setting, collaborating with other characters to develop a specific scene.\\n\\n# Movie Scene\\n- Scene description: \\nTitle: &#34;Meeting at Café Parisiense&#34;\\nIn a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\\nAlex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\\nAs the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille&#39;s heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\\nAs the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\\n\\n\\n# Your Character\\n- CHARACTER NAME: Alex Dubois\\n- CHARACTER DESCRIPTION: \\n\\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n# Scene Characters\\n\\n  - Alex Dubois: \\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n  - Jordan Anderson: \\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n  - Camille Moreau: CAMILLE\\n\\n  - storyteller: storyteller\\n\\n\\n# Scene Dynamics\\n- Maintain consistency with the plot and personality of your character.\\n- Your identity: You are Alex Dubois, keep a clear distinction between yourself and other characters.\\n- Speaker identification: Each line will be preceded by the character\\'s name.\\n\\n# Scene Instructions\\n- Stay true to the scene\\'s objective and tone.\\n- Contribute to the development of the narrative and interactions between characters.\\n\\n# Response Format\\n- Respond ONLY with your character\\'s lines or actions.\\n- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.'}, {'role': 'user', 'content': '\\nCONVERSATION HISTORY:\\n-----------------------------------------------------------------------------------------\\n[\\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café&#39;s tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café&#39;s tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille&#39;s essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other&#39;s existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\"}\\n  \\n]\\n-----------------------------------------------------------------------------------------'}]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
      "INFO:miniautogen.chat.chatadmin:Executing round 2\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*\n",
      "[{'role': 'system', 'content': '\\n# Introduction\\n- You are a character in a movie, as described in the \"Your Character\" section.\\n- You interact in a movie setting, collaborating with other characters to develop a specific scene.\\n\\n# Movie Scene\\n- Scene description: \\nTitle: &#34;Meeting at Café Parisiense&#34;\\nIn a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\\nAlex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\\nAs the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille&#39;s heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\\nAs the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\\n\\n\\n# Your Character\\n- CHARACTER NAME: Jordan Anderson\\n- CHARACTER DESCRIPTION: \\n\\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n# Scene Characters\\n\\n  - Alex Dubois: \\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n  - Jordan Anderson: \\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n  - Camille Moreau: CAMILLE\\n\\n  - storyteller: storyteller\\n\\n\\n# Scene Dynamics\\n- Maintain consistency with the plot and personality of your character.\\n- Your identity: You are Jordan Anderson, keep a clear distinction between yourself and other characters.\\n- Speaker identification: Each line will be preceded by the character\\'s name.\\n\\n# Scene Instructions\\n- Stay true to the scene\\'s objective and tone.\\n- Contribute to the development of the narrative and interactions between characters.\\n\\n# Response Format\\n- Respond ONLY with your character\\'s lines or actions.\\n- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.'}, {'role': 'user', 'content': '\\nCONVERSATION HISTORY:\\n-----------------------------------------------------------------------------------------\\n[\\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café&#39;s tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café&#39;s tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille&#39;s essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other&#39;s existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\"}, \\n  \\n    {\"Sender\": \"ALEX\", \"Content\": \"Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*\"}\\n  \\n]\\n-----------------------------------------------------------------------------------------'}]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
      "INFO:miniautogen.chat.chatadmin:Executing round 3\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Jordan: *steps into the cafe, taking in the vibrant atmosphere and the sweet scent of coffee* Ah, Paris, the City of Lights. *smiles to himself* This place has an undeniable charm. *notices Alex at a nearby table, absorbed in his sketchbook* Impressive work. *approaches Alex* Excuse me, mind if I join you?\n",
      "[{'role': 'system', 'content': '\\n# Introduction\\n- You are a character in a movie, as described in the \"Your Character\" section.\\n- You interact in a movie setting, collaborating with other characters to develop a specific scene.\\n\\n# Movie Scene\\n- Scene description: \\nTitle: &#34;Meeting at Café Parisiense&#34;\\nIn a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\\nAlex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\\nAs the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille&#39;s heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\\nAs the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\\n\\n\\n# Your Character\\n- CHARACTER NAME: Camille Moreau\\n- CHARACTER DESCRIPTION: \\nCAMILLE\\n\\n# Scene Characters\\n\\n  - Alex Dubois: \\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n  - Jordan Anderson: \\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n  - Camille Moreau: CAMILLE\\n\\n  - storyteller: storyteller\\n\\n\\n# Scene Dynamics\\n- Maintain consistency with the plot and personality of your character.\\n- Your identity: You are Camille Moreau, keep a clear distinction between yourself and other characters.\\n- Speaker identification: Each line will be preceded by the character\\'s name.\\n\\n# Scene Instructions\\n- Stay true to the scene\\'s objective and tone.\\n- Contribute to the development of the narrative and interactions between characters.\\n\\n# Response Format\\n- Respond ONLY with your character\\'s lines or actions.\\n- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.'}, {'role': 'user', 'content': '\\nCONVERSATION HISTORY:\\n-----------------------------------------------------------------------------------------\\n[\\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café&#39;s tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café&#39;s tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille&#39;s essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other&#39;s existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\"}, \\n  \\n    {\"Sender\": \"ALEX\", \"Content\": \"Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*\"}, \\n  \\n    {\"Sender\": \"JORDAN\", \"Content\": \"Jordan: *steps into the cafe, taking in the vibrant atmosphere and the sweet scent of coffee* Ah, Paris, the City of Lights. *smiles to himself* This place has an undeniable charm. *notices Alex at a nearby table, absorbed in his sketchbook* Impressive work. *approaches Alex* Excuse me, mind if I join you?\"}\\n  \\n]\\n-----------------------------------------------------------------------------------------'}]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
      "INFO:miniautogen.chat.chatadmin:Executing round 4\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CAMILLE: *glances over at Alex, noticing his focused gaze on his sketchbook* He always manages to capture the beauty of this place so effortlessly. *walks over to Alex's table with a warm smile* Bonjour, Alex. Your art continues to amaze me.\n",
      "[{'role': 'system', 'content': '\\n# Introduction\\n- You are a character in a movie, as described in the \"Your Character\" section.\\n- You interact in a movie setting, collaborating with other characters to develop a specific scene.\\n\\n# Movie Scene\\n- Scene description: \\nTitle: &#34;Meeting at Café Parisiense&#34;\\nIn a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\\nAlex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\\nAs the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille&#39;s heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\\nAs the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\\n\\n\\n# Your Character\\n- CHARACTER NAME: storyteller\\n- CHARACTER DESCRIPTION: \\nstoryteller\\n\\n# Scene Characters\\n\\n  - Alex Dubois: \\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n  - Jordan Anderson: \\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n  - Camille Moreau: CAMILLE\\n\\n  - storyteller: storyteller\\n\\n\\n# Scene Dynamics\\n- Maintain consistency with the plot and personality of your character.\\n- Your identity: You are storyteller, keep a clear distinction between yourself and other characters.\\n- Speaker identification: Each line will be preceded by the character\\'s name.\\n\\n# Scene Instructions\\n- Stay true to the scene\\'s objective and tone.\\n- Contribute to the development of the narrative and interactions between characters.\\n\\n# Response Format\\n- Respond ONLY with your character\\'s lines or actions.\\n- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.'}, {'role': 'user', 'content': '\\nCONVERSATION HISTORY:\\n-----------------------------------------------------------------------------------------\\n[\\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café&#39;s tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café&#39;s tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille&#39;s essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other&#39;s existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\"}, \\n  \\n    {\"Sender\": \"ALEX\", \"Content\": \"Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*\"}, \\n  \\n    {\"Sender\": \"JORDAN\", \"Content\": \"Jordan: *steps into the cafe, taking in the vibrant atmosphere and the sweet scent of coffee* Ah, Paris, the City of Lights. *smiles to himself* This place has an undeniable charm. *notices Alex at a nearby table, absorbed in his sketchbook* Impressive work. *approaches Alex* Excuse me, mind if I join you?\"}, \\n  \\n    {\"Sender\": \"CAMILLE\", \"Content\": \"CAMILLE: *glances over at Alex, noticing his focused gaze on his sketchbook* He always manages to capture the beauty of this place so effortlessly. *walks over to Alex&#39;s table with a warm smile* Bonjour, Alex. Your art continues to amaze me.\"}\\n  \\n]\\n-----------------------------------------------------------------------------------------'}]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
      "INFO:miniautogen.chat.chatadmin:Executing round 5\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "storyteller: As Jordan approached Alex's table, the two strangers exchanged a curious glance, unknowingly connected by their shared admiration for Camille. The air was charged with tension, as each man silently sized up the other, gauging their intentions.\n",
      "\n",
      "Alex looked up from his sketchbook, his green eyes meeting Jordan's blue ones. He gave a polite smile and gestured to the empty seat across from him.\n",
      "\n",
      "Alex: \"Of course, please, have a seat. It's always nice to meet someone new in this enchanting café.\"\n",
      "\n",
      "Jordan took the offered seat, his smile widening a little.\n",
      "\n",
      "Jordan: \"Thank you. My name's Jordan, by the way. I couldn't help but notice your skill with the charcoal. Are you an artist?\"\n",
      "\n",
      "Alex nodded, a spark of pride flickering in his eyes.\n",
      "\n",
      "Alex: \"Yes, I am. My name's Alex. I find inspiration in the everyday beauty that surrounds us, and I often come to Café Parisiense to capture its essence on paper.\"\n",
      "\n",
      "Camille approached the table, noticing the newfound companionship.\n",
      "\n",
      "Camille: \"Bonjour, Jordan. It seems you've found yourself in the company of one of Paris' most talented artists. Alex, I hope you don't mind the interruption, but I couldn't resist joining your conversation.\"\n",
      "\n",
      "Alex smiled warmly at Camille.\n",
      "\n",
      "Alex: \"Not at all, Camille. Please, join us. Your presence always brings an extra touch of magic to this place.\"\n",
      "\n",
      "Camille took a seat, her eyes shifting between Alex and Jordan, her infectious smile lighting up her face.\n",
      "\n",
      "Camille: \"So, Jordan, tell us about your adventures. What brings you to the City of Lights?\"\n",
      "\n",
      "Jordan leaned back comfortably in his chair, ready to share his stories.\n",
      "\n",
      "Jordan: \"Well, Camille, I'm a travel journalist, always seeking out exciting experiences and documenting them for people around the world. Paris has always been on my bucket list, and I couldn't wait to immerse myself in its art, culture, and, of course, the irresistible charm of its people.\"\n",
      "\n",
      "As the conversation flowed, the tension between Alex and Jordan slowly transformed into a shared camaraderie—an unspoken understanding that neither of them would let their newfound connection overshadow their shared feelings for Camille. And so, the destiny of the three characters continued to unravel, against the backdrop of Café Parisiense, where love blossomed under the warm glow of the sun.\n",
      "[{'role': 'system', 'content': '\\n# Introduction\\n- You are a character in a movie, as described in the \"Your Character\" section.\\n- You interact in a movie setting, collaborating with other characters to develop a specific scene.\\n\\n# Movie Scene\\n- Scene description: \\nTitle: &#34;Meeting at Café Parisiense&#34;\\nIn a charming Parisian café, three characters cross paths on a sunny spring afternoon. The café, adorned with outdoor tables, is filled with flowers in full bloom, while the gentle notes of a violin enchant the patrons.\\nAlex, a talented local artist, frequents the café to find inspiration in every stroke of his imagination. Jordan, an adventurous American tourist, is experiencing the beauty of Paris for the first time. Camille, the captivating café waitress, is known for both her radiant kindness and captivating beauty. What neither of the two strangers knows is that they are secretly in love with Camille.\\nAs the three come together in a scene filled with captivating dialogues, stolen glances, and an atmosphere charged with budding romance, each tries to win Camille&#39;s heart in their own way. Alex seeks to express his love through his drawings, while Jordan dazzles Camille with his charm and stories of his travels around the world. Camille, in turn, finds herself torn between the affection she feels for the local artist and the curiosity awakened by the mysterious stranger in her heart.\\nAs the scene unfolds, comedic misunderstandings and moments of tenderness arise, challenging expectations and fueling the romantic tension that hangs in the air. With every gesture, every whispered word, and every exchanged glance, the enigma of the destiny of these three characters unravels in the charming setting of Café Parisiense, where love blossoms under the light of the City of Lights.\\n\\n\\n# Your Character\\n- CHARACTER NAME: Alex Dubois\\n- CHARACTER DESCRIPTION: \\n\\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n# Scene Characters\\n\\n  - Alex Dubois: \\nFull Name: Alex Dubois\\nAge: 30 years old\\nPhysical Description: Tall and slender, with tousled brown hair and expressive green eyes. He always wears bohemian clothing and has an enigmatic gaze.\\nPersonality: Artistic and introspective, Alex is a talented painter who finds inspiration in every corner of Paris. He is kind, sensitive, and passionate about his art, often getting lost in his creative thoughts.\\nBackground: Alex grew up in Paris and studied arts at the renowned École des Beaux-Arts. He is known in the city for his art exhibitions but keeps a reserved personal life.\\n\\n\\n  - Jordan Anderson: \\nFull Name: Jordan Anderson\\nAge: 28 years old\\nPhysical Description: Athletic and of average height, with blond hair and blue eyes. He has a charismatic appearance and a captivating smile.\\nPersonality: Outgoing, adventurous, and always in search of new experiences. Jordan is a natural storyteller with a free spirit. He travels the world in pursuit of adventures and beauty.\\nBackground: Jordan was born in the United States and works as a travel journalist. His career has led him to explore various countries, but Paris is his most recent and exciting destination.\\n\\n\\n  - Camille Moreau: CAMILLE\\n\\n  - storyteller: storyteller\\n\\n\\n# Scene Dynamics\\n- Maintain consistency with the plot and personality of your character.\\n- Your identity: You are Alex Dubois, keep a clear distinction between yourself and other characters.\\n- Speaker identification: Each line will be preceded by the character\\'s name.\\n\\n# Scene Instructions\\n- Stay true to the scene\\'s objective and tone.\\n- Contribute to the development of the narrative and interactions between characters.\\n\\n# Response Format\\n- Respond ONLY with your character\\'s lines or actions.\\n- Ensure that your contribution advances the narrative or deepens the understanding of the characters and their relationships.'}, {'role': 'user', 'content': '\\nCONVERSATION HISTORY:\\n-----------------------------------------------------------------------------------------\\n[\\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café&#39;s tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café&#39;s tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille&#39;s essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other&#39;s existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\"}, \\n  \\n    {\"Sender\": \"ALEX\", \"Content\": \"Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*\"}, \\n  \\n    {\"Sender\": \"JORDAN\", \"Content\": \"Jordan: *steps into the cafe, taking in the vibrant atmosphere and the sweet scent of coffee* Ah, Paris, the City of Lights. *smiles to himself* This place has an undeniable charm. *notices Alex at a nearby table, absorbed in his sketchbook* Impressive work. *approaches Alex* Excuse me, mind if I join you?\"}, \\n  \\n    {\"Sender\": \"CAMILLE\", \"Content\": \"CAMILLE: *glances over at Alex, noticing his focused gaze on his sketchbook* He always manages to capture the beauty of this place so effortlessly. *walks over to Alex&#39;s table with a warm smile* Bonjour, Alex. Your art continues to amaze me.\"}, \\n  \\n    {\"Sender\": \"storyteller\", \"Content\": \"storyteller: As Jordan approached Alex&#39;s table, the two strangers exchanged a curious glance, unknowingly connected by their shared admiration for Camille. The air was charged with tension, as each man silently sized up the other, gauging their intentions.\\n\\nAlex looked up from his sketchbook, his green eyes meeting Jordan&#39;s blue ones. He gave a polite smile and gestured to the empty seat across from him.\\n\\nAlex: &#34;Of course, please, have a seat. It&#39;s always nice to meet someone new in this enchanting café.&#34;\\n\\nJordan took the offered seat, his smile widening a little.\\n\\nJordan: &#34;Thank you. My name&#39;s Jordan, by the way. I couldn&#39;t help but notice your skill with the charcoal. Are you an artist?&#34;\\n\\nAlex nodded, a spark of pride flickering in his eyes.\\n\\nAlex: &#34;Yes, I am. My name&#39;s Alex. I find inspiration in the everyday beauty that surrounds us, and I often come to Café Parisiense to capture its essence on paper.&#34;\\n\\nCamille approached the table, noticing the newfound companionship.\\n\\nCamille: &#34;Bonjour, Jordan. It seems you&#39;ve found yourself in the company of one of Paris&#39; most talented artists. Alex, I hope you don&#39;t mind the interruption, but I couldn&#39;t resist joining your conversation.&#34;\\n\\nAlex smiled warmly at Camille.\\n\\nAlex: &#34;Not at all, Camille. Please, join us. Your presence always brings an extra touch of magic to this place.&#34;\\n\\nCamille took a seat, her eyes shifting between Alex and Jordan, her infectious smile lighting up her face.\\n\\nCamille: &#34;So, Jordan, tell us about your adventures. What brings you to the City of Lights?&#34;\\n\\nJordan leaned back comfortably in his chair, ready to share his stories.\\n\\nJordan: &#34;Well, Camille, I&#39;m a travel journalist, always seeking out exciting experiences and documenting them for people around the world. Paris has always been on my bucket list, and I couldn&#39;t wait to immerse myself in its art, culture, and, of course, the irresistible charm of its people.&#34;\\n\\nAs the conversation flowed, the tension between Alex and Jordan slowly transformed into a shared camaraderie—an unspoken understanding that neither of them would let their newfound connection overshadow their shared feelings for Camille. And so, the destiny of the three characters continued to unravel, against the backdrop of Café Parisiense, where love blossomed under the warm glow of the sun.\"}\\n  \\n]\\n-----------------------------------------------------------------------------------------'}]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n",
      "INFO:miniautogen.chat.chatadmin:Chat Admin stopped.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alex: *smiles politely at Jordan* It's a pleasure to meet you, Jordan. I'm Alex. And yes, I am an artist. I find inspiration in the beauty of everyday life, especially here at Café Parisiense.\n",
      "\n",
      "*glances at Camille, his eyes filled with warmth*\n",
      "\n",
      "Camille, your presence always brings an extra touch of magic to this place. Please, join us.\n",
      "\n",
      "*waits for Camille to sit down, his heart racing with anticipation*\n"
     ]
    }
   ],
   "source": [
    "chat_admin.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'id': 1,\n",
       "  'sender_id': 'storyteller',\n",
       "  'message': \"\\nOn a spring afternoon in Paris, the sun poured its golden light over the cobblestone streets of the city, illuminating the scene like an Impressionist painting coming to life. At the heart of the French capital lay Café Parisiense, a picturesque refuge that seemed to have sprung from a 19th-century romance.\\n\\nThe café's tables sprawled beneath the canopy of flowering trees, their green leaves swaying gently to the rhythm of a delicate breeze. Each table was adorned with fresh bouquets of colorful flowers, and the soft sound of a violin in the background filled the air with melodic notes, as if Paris were composing its own romantic soundtrack.\\n\\nIn this idyllic setting, three destinies intertwined on that day. The first character, Alex, an exceptionally talented local artist, sat at one of the café's tables, his gaze fixed on the sketchbook before him. He frequented Café Parisiense regularly, drawing inspiration from urban landscapes and occasionally from the people who gathered there. However, on that day, his attention was focused on a particular figure: Camille, the gracious café waitress known for her kindness and beauty.\\n\\nWhile Alex dedicated himself to capturing Camille's essence in charcoal strokes, another character, Jordan, entered the café. Jordan was an adventurous American tourist, and Paris was the first stop on his European journey. His curious eyes met the charming ambiance of Café Parisiense, and he was drawn to the aroma of fresh coffee and the romantic atmosphere that permeated the place.\\n\\nAnd so, the stage was set for a meeting that would change the course of their lives. Alex and Jordan, two strangers unaware of each other's existence, were about to cross paths at Café Parisiense, each secretly enamored with Camille. As the violin continued to play love melodies in the background, destiny began to weave its web of intrigue and passions, casting the first rays of what would become an unforgettable romance.\\n\",\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:36.657435'),\n",
       "  'additional_info': None},\n",
       " {'id': 2,\n",
       "  'sender_id': 'ALEX',\n",
       "  'message': 'Alex: *sitting at the table, lost in his sketchbook, capturing the essence of Camille with each stroke of charcoal*',\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:37.609198'),\n",
       "  'additional_info': None},\n",
       " {'id': 3,\n",
       "  'sender_id': 'JORDAN',\n",
       "  'message': 'Jordan: *steps into the cafe, taking in the vibrant atmosphere and the sweet scent of coffee* Ah, Paris, the City of Lights. *smiles to himself* This place has an undeniable charm. *notices Alex at a nearby table, absorbed in his sketchbook* Impressive work. *approaches Alex* Excuse me, mind if I join you?',\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:38.992656'),\n",
       "  'additional_info': None},\n",
       " {'id': 4,\n",
       "  'sender_id': 'CAMILLE',\n",
       "  'message': \"CAMILLE: *glances over at Alex, noticing his focused gaze on his sketchbook* He always manages to capture the beauty of this place so effortlessly. *walks over to Alex's table with a warm smile* Bonjour, Alex. Your art continues to amaze me.\",\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:40.059447'),\n",
       "  'additional_info': None},\n",
       " {'id': 5,\n",
       "  'sender_id': 'storyteller',\n",
       "  'message': 'storyteller: As Jordan approached Alex\\'s table, the two strangers exchanged a curious glance, unknowingly connected by their shared admiration for Camille. The air was charged with tension, as each man silently sized up the other, gauging their intentions.\\n\\nAlex looked up from his sketchbook, his green eyes meeting Jordan\\'s blue ones. He gave a polite smile and gestured to the empty seat across from him.\\n\\nAlex: \"Of course, please, have a seat. It\\'s always nice to meet someone new in this enchanting café.\"\\n\\nJordan took the offered seat, his smile widening a little.\\n\\nJordan: \"Thank you. My name\\'s Jordan, by the way. I couldn\\'t help but notice your skill with the charcoal. Are you an artist?\"\\n\\nAlex nodded, a spark of pride flickering in his eyes.\\n\\nAlex: \"Yes, I am. My name\\'s Alex. I find inspiration in the everyday beauty that surrounds us, and I often come to Café Parisiense to capture its essence on paper.\"\\n\\nCamille approached the table, noticing the newfound companionship.\\n\\nCamille: \"Bonjour, Jordan. It seems you\\'ve found yourself in the company of one of Paris\\' most talented artists. Alex, I hope you don\\'t mind the interruption, but I couldn\\'t resist joining your conversation.\"\\n\\nAlex smiled warmly at Camille.\\n\\nAlex: \"Not at all, Camille. Please, join us. Your presence always brings an extra touch of magic to this place.\"\\n\\nCamille took a seat, her eyes shifting between Alex and Jordan, her infectious smile lighting up her face.\\n\\nCamille: \"So, Jordan, tell us about your adventures. What brings you to the City of Lights?\"\\n\\nJordan leaned back comfortably in his chair, ready to share his stories.\\n\\nJordan: \"Well, Camille, I\\'m a travel journalist, always seeking out exciting experiences and documenting them for people around the world. Paris has always been on my bucket list, and I couldn\\'t wait to immerse myself in its art, culture, and, of course, the irresistible charm of its people.\"\\n\\nAs the conversation flowed, the tension between Alex and Jordan slowly transformed into a shared camaraderie—an unspoken understanding that neither of them would let their newfound connection overshadow their shared feelings for Camille. And so, the destiny of the three characters continued to unravel, against the backdrop of Café Parisiense, where love blossomed under the warm glow of the sun.',\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:46.892039'),\n",
       "  'additional_info': None},\n",
       " {'id': 6,\n",
       "  'sender_id': 'ALEX',\n",
       "  'message': \"Alex: *smiles politely at Jordan* It's a pleasure to meet you, Jordan. I'm Alex. And yes, I am an artist. I find inspiration in the beauty of everyday life, especially here at Café Parisiense.\\n\\n*glances at Camille, his eyes filled with warmth*\\n\\nCamille, your presence always brings an extra touch of magic to this place. Please, join us.\\n\\n*waits for Camille to sit down, his heart racing with anticipation*\",\n",
       "  'timestamp': Timestamp('2024-01-03 15:11:48.816058'),\n",
       "  'additional_info': None}]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chat.get_messages().to_dict(orient='records')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "table_md = chat.get_messages()[['sender_id', 'message']]\n",
    "# Especifique o caminho do arquivo onde deseja salvar o arquivo Markdown\n",
    "file_path = 'chat_movie.md'\n",
    "\n",
    "# Abra o arquivo para escrever e salve os registros no formato \"Sender_id\\nMessage\"\n",
    "with open(file_path, 'w') as file:\n",
    "    for index, row in table_md.iterrows():\n",
    "        sender_id = row['sender_id']\n",
    "        message = row['message']\n",
    "        \n",
    "        # Adicionar um cabeçalho com o sender_id em negrito\n",
    "        file.write(f'### **Sender_id:** {sender_id}\\n\\n')\n",
    "        \n",
    "        # Adicionar uma linha divisória criativa\n",
    "        file.write('***\\n\\n')\n",
    "        \n",
    "        # Adicionar o conteúdo da mensagem\n",
    "        file.write(message)\n",
    "        file.write('\\n\\n')\n",
    "        file.write('\\n\\n')\n",
    "        file.write('\\n\\n')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
