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(
|
return c(
|
||||||
f"""
|
f"""
|
||||||
CUSTOM INSTRUCTIONS:
|
CUSTOM INSTRUCTIONS:
|
||||||
|
These instructions apply to the target peer.
|
||||||
{normalized_custom_instructions}
|
{normalized_custom_instructions}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
@ -54,26 +55,29 @@ def minimal_deriver_prompt(
|
||||||
custom_instructions_section = _custom_instructions_section(custom_instructions)
|
custom_instructions_section = _custom_instructions_section(custom_instructions)
|
||||||
return c(
|
return c(
|
||||||
f"""
|
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
|
- Transform statements into one or multiple conclusions
|
||||||
- Each conclusion must be self-contained with enough context
|
- Each conclusion must be self-contained with enough context
|
||||||
- Use absolute dates/times when possible (e.g. "June 26, 2025" not "yesterday")
|
- Use absolute dates/times when possible (e.g. "June 26, 2025" not "yesterday")
|
||||||
|
|
||||||
RULES:
|
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.
|
- 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 {peer_id}.
|
- 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 {peer_id} messages, using others as context.
|
- 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")
|
- Contextualize each observation sufficiently (e.g. "Ann is nervous about the job interview at the pharmacy" not just "Ann is nervous")
|
||||||
|
|
||||||
EXAMPLES:
|
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 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" → "{peer_id} has a dog", "{peer_id} lives in NYC"
|
- EXPLICIT: "I took my dog for a walk in NYC" → "The target peer has a dog", "The target peer lives in NYC"
|
||||||
- EXPLICIT: "{peer_id} attended college" + general knowledge → "{peer_id} completed high school or equivalent"
|
- EXPLICIT: "The target peer attended college" + general knowledge → "The target peer completed high school or equivalent"
|
||||||
|
|
||||||
{custom_instructions_section}
|
{custom_instructions_section}
|
||||||
|
|
||||||
|
Target peer:
|
||||||
|
{peer_id}
|
||||||
|
|
||||||
Messages to analyze:
|
Messages to analyze:
|
||||||
<messages>
|
<messages>
|
||||||
{messages}
|
{messages}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue