Memco

Function render

  • Render an operation's result as text a model can read.

    Every result carries Instructions — the service's own guidance on what to do with what came back — and that is included, because a model that never sees it is left to guess.

    These results are interfaces, which have no run-time identity, so the dispatch here is on the field only one of them carries. outcome is tested before operationId because a revert carries both.

    The service's guidance names tools. Given a prefix, it is rewritten to name them as the prefix spells them; without one it is left as written. What a memory says is never rewritten.

    Parameters

    • value: Rendered

      Any result a memory operation returns.

    • Optionalprefix: string

      What the tools a model was offered start with, as given to Session.tools. Leave it out to keep the service's text as written.

    Returns string

    The result as text.

    TypeError If the value is not a result this renders. The parameter type stops a typed caller reaching this; the guard is for the untyped ones, which is most agent code.

    console.log(render(await session.search('how does X work')))
    console.log(render(await session.search('how does X work'), 'memco__'))

On this page