Thomas Dybdahl Ahle
Thomas Dybdahl Ahle
Relevant discussion: https://github.com/stanfordnlp/dspy/discussions/420
While working on the method decorators, I realized the `fields` property on `Signature` had a slight issue, as it would sometimes give output fields before input fields, which would screw...
Sounds good. I'll still let you decide when to merge it into main :-) There's a bunch of work I want to do once it's in main, such as actually...
Regarding the actual type checking/fixing, we could either do it using dspy.assertions (like in my first version here https://github.com/thomasahle/dspy/blob/main/examples/types.py) or using a manual retry loop (like in my second version...
Pydantic also supports minimum list lengths: https://github.com/annotated-types/annotated-types?tab=readme-ov-file#minlen-maxlen-len ``` from annotated_types import Len from pydantic import BaseModel class Foo(BaseModel): my_list: Annotated[list[str], Len(min_length=5, max_length=5)] ```
To be clear, this feature would still be incredibly useful to have. When you force the model to output a certain list length, you get answers that are "influences" by...
An alternative idea is to move everything out of the `Signature` namespace and into the module. Then you would do `dspy.signature.instructions(sig)` instead of `sig.dspy_instructions`.
A related issue is "reserved keywords" for `dspy.Predict`. The forward method assigns special meaning to words like `new_signature`, `signature`, `demos`, `config`, `lm`, `past_outputs` and `_trace`. So if a user uses...
If it's required, and it doesn't throw an error, then it's just another kind of bug :-) Can you think of anything that would break if I fixed this to...
@okhat What I'm suggesting in https://github.com/stanfordnlp/dspy/issues/650#issuecomment-2000398219 is exactly to not show the fields if they are not set. The current behaviour is this: ``` Input: What is the speed of...