Skip to content

feat: add context typing so that functions return the type of context passed into them #1522

Description

@jakelorocco

I hit some very annoying type issues because functions don't pass back the type of context passed into them (according to the type system). In reality, I believe all mellea functions pass back the type of context they were initially given.

We should:

  • ensure the assumption that context type of input == context type of output
  • raise exceptions if this is not the case to enforce the convention
  • think about if exceptions to this convention will be needed (probably just for changing the type of context associated with a given session)

We have debated making this a reality in the before; I think we should just commit to this convention.

Metadata

Metadata

Labels

area/contextChatContext, message history, context windowing, serializationarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationenhancementNew feature or requestp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions