Skip to content

Add profile generation use case #508

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

nitpicker55555
Copy link

Search a person's social media, Google Scholar, and other information to automatically build a profile webpage.

Comment on lines 61 to 83
"user": ModelFactory.create(
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
model_type="gpt-4.1",
api_key=os.getenv("OPENAI_API_KEY"),
model_config_dict={"temperature": 0.4},
),
"assistant": ModelFactory.create(
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
model_type="gpt-4.1",
api_key=os.getenv("OPENAI_API_KEY"),
model_config_dict={"temperature": 0.4},
),
"content_researcher": ModelFactory.create(
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
model_type="gpt-4.1",
api_key=os.getenv("OPENAI_API_KEY"),
model_config_dict={"temperature": 0.2},
),
"planning": ModelFactory.create(
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
model_type="gpt-4.1",
api_key=os.getenv("OPENAI_API_KEY"),
model_config_dict={"temperature": 0.3},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use openai model platform instead?

Comment on lines 198 to 233
html_prompt = """
Generate a professional and natural-looking personal profile HTML page based
on the provided information, following these detailed requirements:

Use standard HTML5 structure.

Layout should be clearly organized using <h1> for the main title, <h2> for
section headings, and <p> for paragraph text.

Use proper <a href> hyperlinks for any external links (e.g., LinkedIn,
ResearchGate, Google Scholar).

Write in a natural, flowing narrative style suitable for introducing the
person to a broad audience (no bullet points).

Strictly follow the given content structure:

Personal Information (Name, Positions, Contact( include social media),
Research Keywords)

Summary (Short description of expertise and overall role)

Biography (Detailed career history (can be found in Linkedin) and research
focus)

Research Interests (Areas of active research)

Awards and Distinctions (Honors and recognitions)

Education (Academic degrees in order)

Engage / Related Links (Professional profiles and external resources)

The final HTML should look clean, modern, and ready to be used as a complete
professional personal page.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use response_format in ChatAgent to generate a pydantic object with required fields and use exact the same html template as https://cemse.kaust.edu.sa/profiles/ahmed-eltawil to render the information? Please do not use prompt to generate html.

Comment on lines 213 to 236
html_user_prompt = f"""
Using the following JSON, build a complete HTML5 profile page.

• Sections: Personal Information, Biography, Research Interests, Awards
and Distinctions, Education.
Generate a professional and natural-looking personal profile HTML page
based
on the provided information, following these detailed requirements:
Using standard HTML5 + simple inline CSS, beautiful but not complicated.
Layout should be clearly organized using <h1> for the main title, <h2> for
section headings, and <p> for paragraph text.
Use proper <a href> hyperlinks for any external links (e.g., LinkedIn,
ResearchGate, Google Scholar).
Write in a natural, flowing narrative style suitable for introducing the
person to a broad audience.

Please write ALL the input content to the webpage.
JSON:
{profile.model_dump_json(indent=2)}
"""

html_response = html_agent.step(html_user_prompt)
html_code = html_response.msgs[0].content
html_code_block = re.search(r"```html(.*?)```", html_code, re.DOTALL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use agent for generating HTML? Just use a pre-defined template for this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the updated generated example?

Comment on lines 243 to 252
agent = ChatAgent(
system_message="""Reformat awards as HTML list items using the
structure, Like:
<li class="field__item"><strong>The
NSF CAREER grant in low-power computing and
communication systems</strong>, 2024</li>.""")
for award in awards:
response = agent.step(f"Reformat this: {award}")
formatted_awards.append(response.msgs[0].content.strip())
return "\n".join(formatted_awards)
Copy link
Member

@lightaime lightaime May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not do it in multiple steps. Use response format to format the awards in one shot. Otherwise, it is too exspensive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format problem can be solve by adding examples in the Field description.

Comment on lines 263 to 267
items = []
for degree in degrees:
response = agent.step(f"Reformat this: {degree}")
items.append(response.msgs[0].content.strip())
return "\n".join(items)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not do it in multiple steps. Use response format to format the awards in one shot. Otherwise, it is too exspensive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format problem can be solve by adding examples in the Field description.

Comment on lines 183 to 192
class AwardsAndDistinctions(BaseModel):
honors: list[str] = Field(
description="List of awards, honors, and professional distinctions "
"received")


class Education(BaseModel):
degrees: list[str] = Field(
description="Academic degrees in reverse chronological order, "
"including institution and year")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format problem can be solve by adding examples in the Field description.

Comment on lines 269 to 277
def format_links(links: list[str], html_template: str) -> str:
agent = ChatAgent(
system_message="Reformat link into this html structure: %s ." %
html_template)
items = []
for link in links:
response = agent.step(f"Reformat this: {link}")
items.append(response.msgs[0].content.strip())
return "\n".join(items)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not do it in multiple steps. Use response format to format the awards in one shot. Otherwise, it is too exspensive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants