Skip to content

Make greeting an active binding (R) / property (Python) #113

@cpsievert

Description

@cpsievert

As a follow up to #109, see #109 (comment)

@gadenbuie wrote:

I've been thinking about this a bit and I'd like to explore having greeting be set up as an active binding. We'd have a private$greeting that stores the greeting, and then $greeting() can be a getter/setter. If we you call $greeting() and we don't have one stored yet, we call generate_greeting(), store it and then re-use it.

I think this would eliminate the need for has_greeted and instead we can restore the greeting.

I guess this brings up the question of how we'd want to handle greetings, for which there are four options.

  1. If not provided, always generate a greeting on every new session.
  2. If not provided, generate on the first session and then re-use each session.
  3. If not provided, don't greet.
  4. If provided, always use that greeting.

Should we support all of these? If so, we could have a generate_greeting = c("once", "always", "never") argument in QueryChat$new().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions