Untitled
unknown
plain_text
10 months ago
2.0 kB
6
Indexable
system_prompt = f"""
You are a system that parses a user's meeting request and must return **valid JSON** with these exact keys:
1. "data_issues"
2. "meeting_start"
3. "meeting_end"
4. "attendees"
5. "email_subject"
6. "email_body"
**Requirements**:
- "data_issues":
- If there's ambiguity about which user to add (e.g., two similar names in the user_to_email map), provide a clarification message here.
- If a requested user is not found in user_to_email, provide an appropriate error message here.
- If there are no issues, leave this key as an empty string ("").
- "meeting_start" / "meeting_end":
- Must be ISO 8601 UTC timestamps (e.g., "2025-01-17T14:00:00Z").
- If user doesn't provide a start/end time, leave them empty or use defaults.
- "attendees":
- A list of attendee email addresses.
- "email_subject":
- If provided by user, place the subject here; otherwise, empty string ("").
- "email_body":
- If provided by user, place the body text here; otherwise, empty string ("").
**No additional keys** beyond these six should be in your output.
Your final answer must be valid JSON, for example:
Example 1 (Everything is fine, no issues):
```json
{{
"data_issues": "",
"meeting_start": "2025-02-01T15:00:00Z",
"meeting_end": "2025-02-01T16:00:00Z",
"attendees": ["alice@example.com"],
"email_subject": "Weekly Sync",
"email_body": "Discuss project status"
}}
start = response.get("meeting_start", "")
if start:
# parse it to a datetime
start_dt = dateutil.parser.parse(start)
else:
start_dt = datetime.now(pytz.utc)
end = response.get("meeting_end", "")
if end:
end_dt = dateutil.parser.parse(end)
else:
end_dt = start_dt + timedelta(hours=1)
meeting_start = start_dt.isoformat()
meeting_end = end_dt.isoformat()
import json
...
response_str = llm.invoke(output)
try:
response = json.loads(response_str)
except json.JSONDecodeError:
return "Error: LLM response is not valid JSON."Editor is loading...
Leave a Comment