Updated so user can pass in default name
This commit is contained in:
parent
3a5b0f86fb
commit
afd8c1df21
@ -50,25 +50,19 @@ emptyUser = {
|
||||
"questions": [],
|
||||
}
|
||||
|
||||
generate_persona_system_prompt = """\
|
||||
def generate_persona_system_prompt(persona: Dict[str, Any]) -> str:
|
||||
return f"""\
|
||||
You are a casting director for a movie. Your job is to provide information on ficticious personas for use in a screen play.
|
||||
|
||||
All response field MUST BE IN ENGLISH, regardless of ethnicity.
|
||||
|
||||
You will be provided with defaults to use if not specified by the user:
|
||||
Use the following defaults, unless the user indicates they should be something else:
|
||||
|
||||
```json
|
||||
{
|
||||
"age": number,
|
||||
"gender": "male" | "female",
|
||||
"ethnicity": string,
|
||||
"full_name": string,
|
||||
"first_name": string,
|
||||
"last_name": string,
|
||||
}
|
||||
{json.dumps(persona, indent=4)}
|
||||
```
|
||||
|
||||
Additional information provided in the user message can override those defaults.
|
||||
Additional information provided in the user message can override those defaults. For example, if the user provides a name, you should use that name instead of the defaults.
|
||||
|
||||
You need to randomly assign an English username (can include numbers), a first name, last name, and a two English sentence description of
|
||||
that individual's work given the demographics provided.
|
||||
@ -78,14 +72,17 @@ Provide only the JSON response, and match the field names EXACTLY.
|
||||
Provide all information in English ONLY, with no other commentary:
|
||||
|
||||
```json
|
||||
{
|
||||
{{
|
||||
"first_name": string, # First name of the person. If the user , use the first name provided or generated
|
||||
"full_name": string, # Full name of the person, use the first and last name provided or generated
|
||||
"last_name": string, # Last name of the person, use the last name provided or generated
|
||||
"username": string, # A likely-to-be unique username, no more than 15 characters (can include numbers and letters but no special characters)
|
||||
"description": string, # One to two sentence description of their job
|
||||
"location": string, # In the location, provide ALL of: City, State/Region, and Country
|
||||
"phone": string, # Location appropriate phone number with area code
|
||||
"email": string, # primary email address
|
||||
"title": string, # Job title of their current job
|
||||
}
|
||||
}}
|
||||
```
|
||||
|
||||
Make sure to provide a username and that the field name for the job description is "description".
|
||||
@ -296,7 +293,6 @@ class GeneratePersona(Agent):
|
||||
_agent_type: ClassVar[str] = agent_type # Add this for registration
|
||||
agent_persist: bool = False
|
||||
|
||||
system_prompt: str = generate_persona_system_prompt
|
||||
age: int = 0
|
||||
gender: str = ""
|
||||
username: str = ""
|
||||
@ -325,16 +321,18 @@ class GeneratePersona(Agent):
|
||||
|
||||
original_prompt = prompt.strip()
|
||||
|
||||
prompt = f"""\
|
||||
```json
|
||||
{json.dumps({
|
||||
persona = {
|
||||
"age": self.age,
|
||||
"gender": self.gender,
|
||||
"ethnicity": self.ethnicity,
|
||||
"full_name": self.full_name,
|
||||
"first_name": self.first_name,
|
||||
"last_name": self.last_name,
|
||||
})}
|
||||
}
|
||||
|
||||
prompt = f"""\
|
||||
```json
|
||||
{json.dumps(persona)}
|
||||
```
|
||||
"""
|
||||
|
||||
@ -346,13 +344,13 @@ Incorporate the following into the job description: {original_prompt}
|
||||
#
|
||||
# Generate the persona
|
||||
#
|
||||
logger.info(f"🤖 Generating persona for {self.full_name}")
|
||||
logger.info(f"🤖 Generating persona...")
|
||||
generating_message = None
|
||||
async for generating_message in self.llm_one_shot(
|
||||
llm=llm, model=model,
|
||||
session_id=session_id,
|
||||
prompt=prompt,
|
||||
system_prompt=generate_persona_system_prompt,
|
||||
system_prompt=generate_persona_system_prompt(persona=persona),
|
||||
temperature=temperature,
|
||||
):
|
||||
if generating_message.status == ApiStatusType.ERROR:
|
||||
|
Loading…
x
Reference in New Issue
Block a user