Skip to content

fix: extraction model + prompt tuning + seed format#169

Merged
sfreeman422 merged 3 commits intodev-chat:masterfrom
whorne89:feat/prompt-tuning-and-seeding
Mar 21, 2026
Merged

fix: extraction model + prompt tuning + seed format#169
sfreeman422 merged 3 commits intodev-chat:masterfrom
whorne89:feat/prompt-tuning-and-seeding

Conversation

@whorne89
Copy link

Summary

  • Switched extraction from gpt-5.2 to gpt-4.1-nano — extraction was going through generateText() which hardcodes the response model. Now calls GATE_MODEL directly like selection already does. This was causing memories to be created from casual one-off questions.
  • Tightened extraction prompt — added explicit NONE bias, concrete skip examples (asking a factual question is not energy), and strengthened REINFORCE criteria to require sustained engagement.
  • Reformatted seed SQL — content now matches runtime extraction style (lowercase, direct, behavioral) instead of the old third-person narrative format.

Test plan

  • Deploy and verify extraction stops firing on casual single questions
  • Verify memories still get created during actual debates/sustained engagement
  • Confirm seed SQL runs clean if re-seeding is needed
  • Check logs for extraction lock + NONE returns on idle chatter

🤖 Generated with Claude Code

…k memories

Extraction was using gpt-5.2 via generateText() instead of gpt-4.1-nano.
The smart model was extracting memories from casual one-off questions (e.g.
"what happened to chuck norris"). Now uses GATE_MODEL directly like selection
does. Also strengthened the extraction prompt — NONE is the default, asking
a question is not energy, added concrete NONE examples. Seed SQL reformatted
to match runtime extraction style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@whorne89 whorne89 force-pushed the feat/prompt-tuning-and-seeding branch from 93d678f to bf50e99 Compare March 21, 2026 01:21
Steve will run it separately — doesn't belong in the codebase.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
const prompt = MEMORY_EXTRACTION_PROMPT.replace('{existing_memories}', existingMemoriesText);

const result = await this.openAiService.generateText(extractionInput, 'extraction', prompt);
const response = await this.openAiService.openai.responses.create({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't do this, instead expose a param here on this.openAiService.generateText that optionally lets you control what model to use.

With the pattern you have here, you are accessing what realistically should be a private attribute of the openAiService since itself is another class (the OpenAI lib) which openAIService depends on.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's actually an argument here that we don't need the openAiService as its a fairly lightweight wrapper for the OpenAI Library... esp if @bajman ever addresses my PR feedback on #164 and #163

…ng openai client directly

Per Steve's review — extraction and selection now use generateText()
with an optional model override instead of reaching into
openAiService.openai. Web search tools are skipped when using a
custom model (gate model doesn't need them).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
model: GPT_MODEL,
tools: [{ type: 'web_search_preview' }],
model: model || GPT_MODEL,
...(model ? {} : { tools: [{ type: 'web_search_preview' }] }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might break the tool calling.. Why did Claude do this? Nano doesn't have tool calling or something?

Copy link
Author

Choose a reason for hiding this comment

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

Right — gpt-4.1-nano doesn't support web_search_preview. It throws an error if you pass tools to it. The conditional skips tools when a custom model is passed (extraction/selection via nano), but keeps them for the default path (GPT-5.2 responses). Extraction and selection don't need web search anyway — they're analyzing conversation text that's already in the prompt.

.create({
model: GPT_MODEL,
tools: [{ type: 'web_search_preview' }],
model: model || GPT_MODEL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of this just make the model have a default param. IE: model = GPT_MODEL in the function params

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then we can always pass model here and it'll either be the default when the caller doesn't pass one in, or it'll be whatever they passed in. Slightly more clean (this is kinda becoming a nit though because we might get rid of this class entirely in the near future if @bajman EVER GETS IT TOGETHER COUGH COUGH AHEM)

@sfreeman422 sfreeman422 merged commit bdd5f04 into dev-chat:master Mar 21, 2026
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