Commit e7505a1
authored
Update chain_of_thought.py (stanfordnlp#8006)
* Update chain_of_thought.py
Allow use of custom CoT representations (e.g., List of strings) instead of forcing CoT be a string output.
Previously, even if the user passed in a custom definition for the reasoning field, the type of the reasoning field output would be a string.
This change ensures that the type of the field is consistent with its annotation, and allows for users to specify a custom type for reasoning without creating a custom field for it.
Also, this change introduces a docstring and type hints into the ChainOfThought module.
* Update chain_of_thought.py
Fixed error due to missing import.
* Update chain_of_thought.py
Avoid circular import and ensure there are two newlines between imports and initial code.
* Update chain_of_thought.py
Avoided circular import caused by referencing `dspy.OutputField`1 parent 48cb347 commit e7505a1
1 file changed
+24
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
8 | 27 | | |
9 | | - | |
10 | 28 | | |
11 | | - | |
12 | 29 | | |
13 | 30 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
17 | 34 | | |
18 | 35 | | |
19 | 36 | | |
| |||
0 commit comments