pathwaycom / pathway

Python ETL framework for stream processing, real-time analytics, LLM pipelines, and RAG.
https://pathway.com
Other
2.84k stars 98 forks source link

[Bug]: Error with subclassing behavior in pw.Schema #9

Open berkecanrizai opened 3 months ago

berkecanrizai commented 3 months ago

Steps to reproduce

If you have a schema that has an optional parameter, and you create a subclass of that schema, the optional parameter becomes non-optional.

Example:

class SummarizeQuerySchema(pw.Schema):
    text_list: list[str]
    model: str | None = pw.column_definition(default_value="gpt-3.5-turbo")
class SummarizeQuerySchemaAPI(SummarizeQuerySchema):
    openai_api_key: str

In this case, model that was optional becomes non-optional in the second schema.

Relevant log output

I get an error message stating `model` is needed during runtime.

What did you expect to happen?

It should keep the initial behavior after inheriting.

Version

0.8.2

Docker Versions (if used)

No response

OS

Linux

On which CPU architecture did you run Pathway?

x86-64