Skip to content

last_turns

last_turns(n, *, without=())

Show the model only the last n earlier turns.

The turns left out are still kept, and each turn's record says which earlier turns it was shown (turn.saw), so an answer can be asked again exactly as it was.

Parameters

Name Type Description Default
n int How many earlier turns are shown (0: none). required
without list of str Inputs or outputs left out of every earlier turn. ()

Returns

Name Type Description
Context For fn.conversation(context=...).

See Also

  • all_turns: every earlier turn (the default).
  • compaction: older turns folded into a summary instead of dropped.

Examples

import functai
from functai import *
# not run: part of a program (the Memory guide runs whole ones)
qa = reader.conversation(context=functai.last_turns(10, without=["document"]))