Optimize deriver prompt prefix caching
This commit is contained in:
parent
724d60af2f
commit
0859f77ff0
|
|
@ -31,6 +31,7 @@ def _custom_instructions_section(custom_instructions: str | None) -> str:
|
|||
return c(
|
||||
f"""
|
||||
CUSTOM INSTRUCTIONS:
|
||||
These instructions apply to the target peer.
|
||||
{normalized_custom_instructions}
|
||||
"""
|
||||
)
|
||||
|
|
@ -54,26 +55,29 @@ def minimal_deriver_prompt(
|
|||
custom_instructions_section = _custom_instructions_section(custom_instructions)
|
||||
return c(
|
||||
f"""
|
||||
Analyze messages from {peer_id} to extract **explicit atomic facts** about them.
|
||||
Analyze messages to extract **explicit atomic facts** about the target peer.
|
||||
|
||||
[EXPLICIT] DEFINITION: Facts about {peer_id} that can be derived directly from their messages.
|
||||
[EXPLICIT] DEFINITION: Facts about the target peer that can be derived directly from their messages.
|
||||
- Transform statements into one or multiple conclusions
|
||||
- Each conclusion must be self-contained with enough context
|
||||
- Use absolute dates/times when possible (e.g. "June 26, 2025" not "yesterday")
|
||||
|
||||
RULES:
|
||||
- Properly attribute observations to the correct subject: if it is about {peer_id}, say so. If {peer_id} is referencing someone or something else, make that clear.
|
||||
- Observations should make sense on their own. Each observation will be used in the future to better understand {peer_id}.
|
||||
- Extract ALL observations from {peer_id} messages, using others as context.
|
||||
- Properly attribute observations to the correct subject: if it is about the target peer, say so. If the target peer is referencing someone or something else, make that clear.
|
||||
- Observations should make sense on their own. Each observation will be used in the future to better understand the target peer.
|
||||
- Extract ALL observations from the target peer's messages, using others as context.
|
||||
- Contextualize each observation sufficiently (e.g. "Ann is nervous about the job interview at the pharmacy" not just "Ann is nervous")
|
||||
|
||||
EXAMPLES:
|
||||
- EXPLICIT: "I just had my 25th birthday last Saturday" → "{peer_id} is 25 years old", "{peer_id}'s birthday is June 21st"
|
||||
- EXPLICIT: "I took my dog for a walk in NYC" → "{peer_id} has a dog", "{peer_id} lives in NYC"
|
||||
- EXPLICIT: "{peer_id} attended college" + general knowledge → "{peer_id} completed high school or equivalent"
|
||||
- EXPLICIT: "I just had my 25th birthday last Saturday" → "The target peer is 25 years old", "The target peer's birthday is June 21st"
|
||||
- EXPLICIT: "I took my dog for a walk in NYC" → "The target peer has a dog", "The target peer lives in NYC"
|
||||
- EXPLICIT: "The target peer attended college" + general knowledge → "The target peer completed high school or equivalent"
|
||||
|
||||
{custom_instructions_section}
|
||||
|
||||
Target peer:
|
||||
{peer_id}
|
||||
|
||||
Messages to analyze:
|
||||
<messages>
|
||||
{messages}
|
||||
|
|
|
|||
Loading…
Reference in New Issue