Giter Site home page Giter Site logo

opendfm / ibsen Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 0.0 148.34 MB

[ACL 2024] Official code for "IBSEN: Director-Actor Agent Collaboration for Controllable and Interactive Drama Script Generation" (TheatreMaker)

Home Page: https://opendfm.github.io/ibsen/

License: MIT License

Python 100.00%
drama generative-agents large-language-models multi-agent-systems

ibsen's People

Contributors

cnlnpjhsy avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ibsen's Issues

执行程序报错,求帮忙看看

Hi~感谢您杰出的工作。

在执行时,prompter.py调用guidance库报错:

image

_gen.py", line 171, in gen
new_text = resp["choices"][0].get("text", ""):IndexError: list index out of range,

日志中发现,guidance以stream的形式返回结果,在最后一个地方为空。但在前面的参数已设置stream为False。

我已将上面错误的MWE提取出,执行下面代码可复现本Issue中的问题。

import guidance

guidance.llm = guidance.llms.OpenAI(
    model="gpt-3.5-turbo",
    api_key="your api key",
    api_base="your api base",
)

full_prompt = """
{{#system~}}
Assuming you are currently an actor performing in a drama play. Your role is {{name}}.

Background of the drama script: {{background}}

Character description for {{name}}: {{description}}

Based on the information above, I will tell you the script that has unfolded so far in the play. Please role-play as {{name}} and respond with an appropriate line of the dialogue.

Do not role-play other characters; generate only what your character would say. Avoid multi-turn responses; generate only the next line. Do not repeat the existing script. You can output only one line of text.

A director will guide you on how to better embody your role. Consider the context, director's guidance, your character's image, memories, and impressions on others to generate the most fitting line of dialogue as an actor.
{{~/system}}
{{#system~}}
Impressions of Hedda Gai on characters below: 
On Eilert Luo: Hedda Gai still can't get over Eilert Luo, her lingering ex-lover, and feels he is decisive and ensures that everything turns out beautifully. She attempted to exert influence and control over Eilert Luo to win over Thea Fu, but he seemed indifferent towards her. Hedda Gai ultimately deceived George Dai by burning Eilert Luo's notebook.
On George Dai: George Dai is obedient to Hedda Gai, almost like a 'mama's boy.' Hedda Gai feels that George Dai is kind and honest, but she also manipulated him to support her political career. George Dai is envious and jealous of Eilert Luo's research achievements, which pose a threat to his academic standing.
On Berta: No information available.

Related content in the memory of Hedda Gai: 
Faced with Thea Fu's attacks, I simply said calmly that people change and learn. After the debate, my PR team had to edit out the jewelry and luxury watches from the photos.
"Ha, Eilert Luo really got completely drunk at the event, he's really unreliable. He even lost the notebook with important academic content recorded in it."
Thea Fu used to protest in the corner at school, thinking that her beliefs could change something.
I have decided to hold a press conference to mourn the passing of Eilert Luo.
After the last debate ended, I invited Eilert Luo and Chief Justice Brack to my house as guests.
George Dai found Eilert Luo's notebook in his car, handed it over to me for safekeeping, and then hurried out to run some errands.
I have decided to use George Dai to undermine the trust between Eilert Luo and Thea Fu. I convinced him and the Chief Justice Brack to take Eilert Luo to a political fundraiser, where Eilert Luo is sure to drink alcohol.
The press conference is about to start, and I'm in the green room with George Dai, getting ready for the press conference.
George Dai's panic is irrelevant to me, I only care that Eilert Luo's suicide aligns with my perception of him. I'm determined to act decisively, as long as the results are satisfying.
Haha, George Dai really believed that I burned Eilert Luo's notebook out of love between us. But it's okay, he has also decided to stop worrying about this matter.
I deceived George Dai by saying that burning the notebook was for the future of both of us, George Dai's academic status, and my own election.

**Instructions from the director: **You are in the following plot:
Hedda Gai, feeling a moment of vulnerability after Berta's departure, turns to George Dai with a soft smile. She begins to reminisce about the past events, particularly the public debate and the casual gathering at their home with Eilert Luo and Chief Justice Brack. As they chat, Hedda's demeanor shifts from her usual composed self to a more introspective and contemplative one, hinting at deeper emotions beneath her political facade. George Dai, noticing this change, tries to comfort her, showcasing a rare moment of genuine connection between the couple amidst the chaos of their public lives. The conversation between Hedda Gai and George Dai becomes a poignant reflection on their shared history and the complexities of their intertwined destinies.
Please follow the instructions below to play the role of Hedda Gai: 
If the instructions conflict with the memory of Hedda Gai, just follow the memory content.


{{~/system}}
{{#user~}}
Previous scripts: 
(Before the press conference commemorating Eilert Luo begins, in the hotel lobby. Assistant Berta rushes out of the lobby with the public relations team, leaving only Hedda Gai and George Dai.)
(Feeling a moment of vulnerability after Berta's departure, Hedda Gai turns to George Dai with a soft smile.)
Hedda Gai: 
{{~/user}}

{{#assistant~}}
{{gen 'dialogue' temperature=0.6 frequency_penalty=0.6}}
{{~/assistant}}
"""

silent = False
name = "Mary"
description = """
Mary is an entertainment journalist working for "Supernova Entertainment", a publication that tends to focus on sensational and flamboyant stories. After all, in the entertainment industry, attention-grabbing headlines are often more captivating than politics.
"""
background = """
Before the press conference to mourn Eilert Luo, many reporters and citizens have already waiting in the hall. Some reporters begin to chat about their expectations for this press conference.
"""

prompt = guidance(full_prompt, silent=silent)

result = prompt(
    name=name,
    description=description,
    background=background,
    stream=False,
)

print(result)

求帮忙看看,不胜感谢~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.