Skip to content

Commit 9779a23

Browse files
committed
Fix program test
1 parent 43b9ad5 commit 9779a23

File tree

10 files changed

+28
-32
lines changed

10 files changed

+28
-32
lines changed

notebooks/conversational_applications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def _():
99
import marimo as mo
1010
import synalinks
11-
11+
1212
synalinks.backend.clear_session()
1313
return mo, synalinks
1414

@@ -57,7 +57,7 @@ async def _(synalinks):
5757
_x1 = await synalinks.Generator(
5858
language_model=language_model,
5959
prompt_template=synalinks.chat_prompt_template(),
60-
streaming=False, # Marimo chat don't handle streaming yet
60+
streaming=False, # Marimo chat don't handle streaming yet
6161
)(_x0)
6262

6363
program = synalinks.Program(

notebooks/first_steps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
def _():
99
import marimo as mo
1010
import synalinks
11-
11+
1212
synalinks.backend.clear_session()
13-
13+
1414
return mo, synalinks
1515

1616

notebooks/implementing_custom_modules_and_programs_via_subclassing.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@ def _(synalinks):
6262
from synalinks import ops
6363

6464
class Thinking(synalinks.DataModel):
65-
thinking: str = synalinks.Field(
66-
description="Your step by step thinking process"
67-
)
65+
thinking: str = synalinks.Field(description="Your step by step thinking process")
6866

6967
class CritiqueWithReward(synalinks.DataModel):
70-
critique: str = synalinks.Field(
71-
description="The step by step critique"
72-
)
68+
critique: str = synalinks.Field(description="The step by step critique")
7369
reward: float = synalinks.Field(
7470
description="The reward corresponding to the critique between [0.0, 1.0]",
7571
le=1.0,
@@ -108,25 +104,23 @@ def __init__(
108104
self.stop_threshold = stop_threshold
109105
self.max_iterations = max_iterations
110106
self.critique_program = critique_program
111-
self.prompt_template= prompt_template
107+
self.prompt_template = prompt_template
112108
self.examples = examples
113109
self.hints = hints
114110
self.use_inputs_schema = use_inputs_schema
115111
self.use_outputs_schema = use_outputs_schema
116112
if not self.critique_program:
117113
# If no critique program is provided
118114
# We compute the reward in the thinking step
119-
thinking_data_model = \
120-
Thinking \
121-
+ synalinks.SymbolicDataModel(
122-
schema=self.schema
123-
) + CritiqueWithReward
115+
thinking_data_model = (
116+
Thinking
117+
+ synalinks.SymbolicDataModel(schema=self.schema)
118+
+ CritiqueWithReward
119+
)
124120
else:
125-
thinking_data_model = \
126-
Thinking \
127-
+ synalinks.SymbolicDataModel(
128-
schema=self.schema
129-
)
121+
thinking_data_model = Thinking + synalinks.SymbolicDataModel(
122+
schema=self.schema
123+
)
130124
# This is for generating the intermediary steps
131125
self.thinking = synalinks.Generator(
132126
data_model=thinking_data_model,
@@ -136,7 +130,7 @@ def __init__(
136130
hints=self.hints,
137131
use_inputs_schema=self.use_inputs_schema,
138132
use_outputs_schema=self.use_outputs_schema,
139-
name=self.name+"_thinking_generator",
133+
name=self.name + "_thinking_generator",
140134
)
141135
# This is going to be the final generator
142136
self.generator = synalinks.Generator(
@@ -147,7 +141,7 @@ def __init__(
147141
hints=self.hints,
148142
use_inputs_schema=self.use_inputs_schema,
149143
use_outputs_schema=self.use_outputs_schema,
150-
name=self.name+"_generator",
144+
name=self.name + "_generator",
151145
)
152146

153147
async def call(self, inputs, training=False):
@@ -167,9 +161,7 @@ async def call(self, inputs, training=False):
167161
if reward > self.stop_threshold:
168162
break
169163
inputs = await ops.concat(
170-
inputs,
171-
thinking,
172-
name=self.name+f"_thinking_{i}"
164+
inputs, thinking, name=self.name + f"_thinking_{i}"
173165
)
174166
return await self.generator(inputs)
175167

@@ -190,7 +182,7 @@ def get_config(self):
190182
"name": self.name,
191183
"description": self.description,
192184
"trainable": self.trainable,
193-
}
185+
}
194186
language_model_config = {
195187
"language_model": synalinks.saving.serialize_synalinks_object(
196188
self.language_model,
@@ -224,6 +216,7 @@ def from_config(cls, config):
224216
critique_program=critique_program,
225217
**config,
226218
)
219+
227220
return BacktrackingOfThought, CritiqueWithReward, Thinking, ops
228221

229222

notebooks/rewards_metrics_and_optimizers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
def _():
99
import marimo as mo
1010
import synalinks
11-
11+
1212
synalinks.backend.clear_session()
13-
13+
1414
return mo, synalinks
1515

1616

@@ -101,7 +101,6 @@ def _(mo):
101101

102102
@app.cell
103103
async def _(synalinks):
104-
105104
synalinks.backend.clear_session()
106105

107106
class Query(synalinks.DataModel):

synalinks/src/backend/common/dynamic_json_schema_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
22

3+
34
def dynamic_enum(schema, prop_to_update, labels):
45
"""Update a schema with dynamic Enum string
56
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
22

3+
34
class PydanticModule:
45
pass

synalinks/src/programs/functional.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Original authors: François Chollet et al. (Keras Team)
33
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
44

5+
import asyncio
56
import copy
67
import inspect
78
import typing

synalinks/src/programs/program_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AnswerWithRationale(DataModel):
4646
"variable": {
4747
"prompt_template": default_prompt_template(),
4848
"examples": [],
49-
"hints": default_hints(),
49+
"hints": [],
5050
"predictions": [],
5151
}
5252
}

synalinks/src/trainers/data_adapters/data_adapter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Original authors: François Chollet et al. (Keras Team)
33
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
44

5+
56
class DataAdapter:
67
"""Base class for input data adapters.
78

synalinks/src/utils/plot_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def plot_history(
7878
pass
7979
try:
8080
import marimo as mo
81-
81+
8282
if mo.running_in_notebook():
8383
return mo.image(src=to_file).center()
8484
except ImportError:

0 commit comments

Comments
 (0)