Skip to content

Commit 5bd751b

Browse files
committed
Update theme and programs docs
1 parent 309439b commit 5bd751b

File tree

5 files changed

+302
-147
lines changed

5 files changed

+302
-147
lines changed

README.md

Lines changed: 100 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,20 @@ You start from `Input`, you chain modules calls to specify the program's structu
7676
import synalinks
7777
import asyncio
7878

79-
async def main():
80-
class Query(synalinks.DataModel):
81-
query: str = synalinks.Field(
82-
description="The user query",
83-
)
79+
class Query(synalinks.DataModel):
80+
query: str = synalinks.Field(
81+
description="The user query",
82+
)
8483

85-
class AnswerWithThinking(synalinks.DataModel):
86-
thinking: str = synalinks.Field(
87-
description="Your step by step thinking process",
88-
)
89-
answer: float = synalinks.Field(
90-
description="The correct numerical answer",
91-
)
84+
class AnswerWithThinking(synalinks.DataModel):
85+
thinking: str = synalinks.Field(
86+
description="Your step by step thinking process",
87+
)
88+
answer: float = synalinks.Field(
89+
description="The correct numerical answer",
90+
)
91+
92+
async def main():
9293

9394
language_model = synalinks.LanguageModel(
9495
model="ollama/mistral",
@@ -121,73 +122,74 @@ In that case, you should define your modules in `__init__()` and implement the p
121122
import synalinks
122123
import asyncio
123124

124-
async def main():
125-
class Query(synalinks.DataModel):
126-
query: str = synalinks.Field(
127-
description="The user query",
128-
)
125+
class Query(synalinks.DataModel):
126+
query: str = synalinks.Field(
127+
description="The user query",
128+
)
129129

130-
class AnswerWithThinking(synalinks.DataModel):
131-
thinking: str = synalinks.Field(
132-
description="Your step by step thinking process",
130+
class AnswerWithThinking(synalinks.DataModel):
131+
thinking: str = synalinks.Field(
132+
description="Your step by step thinking process",
133+
)
134+
answer: float = synalinks.Field(
135+
description="The correct numerical answer",
136+
)
137+
138+
class ChainOfThought(synalinks.Program):
139+
"""Useful to answer in a step by step manner.
140+
141+
The first line of the docstring is provided as description
142+
for the program if not provided in the `super().__init__()`.
143+
In a similar way the name is automatically infered based on
144+
the class name if not provided.
145+
"""
146+
147+
def __init__(
148+
self,
149+
language_model=None,
150+
name=None,
151+
description=None,
152+
trainable=True,
153+
):
154+
super().__init__(
155+
name=name,
156+
description=description,
157+
trainable=trainable,
133158
)
134-
answer: float = synalinks.Field(
135-
description="The correct numerical answer",
159+
self.answer = synalinks.Generator(
160+
data_model=AnswerWithThinking,
161+
language_model=language_model,
162+
name=self.name+"_generator",
136163
)
137164

138-
class ChainOfThought(synalinks.Program):
139-
"""Useful to answer in a step by step manner.
140-
141-
The first line of the docstring is provided as description
142-
for the program if not provided in the `super().__init__()`.
143-
In a similar way the name is automatically infered based on
144-
the class name if not provided.
145-
"""
146-
147-
def __init__(
148-
self,
149-
language_model=None,
150-
name=None,
151-
description=None,
152-
trainable=True,
153-
):
154-
super().__init__(
155-
name=name,
156-
description=description,
157-
trainable=trainable,
158-
)
159-
self.answer = synalinks.Generator(
160-
data_model=AnswerWithThinking,
161-
language_model=language_model,
162-
name=self.name+"_generator",
165+
async def call(self, inputs, training=False):
166+
if not inputs:
167+
return None
168+
x = await self.answer(inputs, training=training)
169+
return x
170+
171+
def get_config(self):
172+
config = {
173+
"name": self.name,
174+
"description": self.description,
175+
"trainable": self.trainable,
176+
}
177+
language_model_config = \
178+
{
179+
"language_model": synalinks.saving.serialize_synalinks_object(
180+
self.language_model
163181
)
182+
}
183+
return {**config, **language_model_config}
164184

165-
async def call(self, inputs, training=False):
166-
if not inputs:
167-
return None
168-
x = await self.answer(inputs, training=training)
169-
return x
170-
171-
def get_config(self):
172-
config = {
173-
"name": self.name,
174-
"description": self.description,
175-
"trainable": self.trainable,
176-
}
177-
language_model_config = \
178-
{
179-
"language_model": synalinks.saving.serialize_synalinks_object(
180-
self.language_model
181-
)
182-
}
183-
return {**config, **language_model_config}
184-
185-
@classmethod
186-
def from_config(cls, config):
187-
language_model = synalinks.saving.deserialize_synalinks_object(
188-
config.pop("language_model")
189-
)
190-
return cls(language_model=language_model, **config)
185+
@classmethod
186+
def from_config(cls, config):
187+
language_model = synalinks.saving.deserialize_synalinks_object(
188+
config.pop("language_model")
189+
)
190+
return cls(language_model=language_model, **config)
191+
192+
async def main():
191193

192194
language_model = synalinks.LanguageModel(
193195
model="ollama/mistral",
@@ -211,20 +213,20 @@ In that case, you should implement only the `__init__()` and `build()` methods.
211213
import synalinks
212214
import asyncio
213215

214-
async def main():
216+
class Query(synalinks.DataModel):
217+
query: str = synalinks.Field(
218+
description="The user query",
219+
)
215220

216-
class Query(synalinks.DataModel):
217-
query: str = synalinks.Field(
218-
description="The user query",
219-
)
221+
class AnswerWithThinking(synalinks.DataModel):
222+
thinking: str = synalinks.Field(
223+
description="Your step by step thinking process",
224+
)
225+
answer: float = synalinks.Field(
226+
description="The correct numerical answer",
227+
)
220228

221-
class AnswerWithThinking(synalinks.DataModel):
222-
thinking: str = synalinks.Field(
223-
description="Your step by step thinking process",
224-
)
225-
answer: float = synalinks.Field(
226-
description="The correct numerical answer",
227-
)
229+
async def main():
228230

229231
class ChainOfThought(synalinks.Program):
230232
"""Useful to answer in a step by step manner."""
@@ -283,19 +285,20 @@ is purely a stack of single-input, single-output modules.
283285
import synalinks
284286
import asyncio
285287

286-
async def main():
287-
class Query(synalinks.DataModel):
288-
query: str = synalinks.Field(
289-
description="The user query",
290-
)
288+
class Query(synalinks.DataModel):
289+
query: str = synalinks.Field(
290+
description="The user query",
291+
)
291292

292-
class AnswerWithThinking(synalinks.DataModel):
293-
thinking: str = synalinks.Field(
294-
description="Your step by step thinking process",
295-
)
296-
answer: float = synalinks.Field(
297-
description="The correct numerical answer",
298-
)
293+
class AnswerWithThinking(synalinks.DataModel):
294+
thinking: str = synalinks.Field(
295+
description="Your step by step thinking process",
296+
)
297+
answer: float = synalinks.Field(
298+
description="The correct numerical answer",
299+
)
300+
301+
async def main():
299302

300303
language_model = synalinks.LanguageModel(
301304
model="ollama/mistral",

docs/stylesheets/extra.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
[data-md-color-scheme="default"] {
33
--md-default-bg-color: #fdf6e3;
44
--md-default-fg-color: #002c37;
5+
56

67
--md-primary-bg-color: #fdf6e3;
7-
--md-primary-fg-color: #002c37;
8+
--md-primary-fg-color: #0a3642;
9+
--md-primary-fg-color--dark: #002c37;
10+
--md-primary-fg-color--light: #0a3642;
811

912
--md-accent-fg-color: #d56564;
1013

1114
--md-code-fg-color: #002c37;
1215
--md-code-bg-color: #ffffff;
1316

14-
--md-footer-fg-color: #002c37;
15-
--md-footer-bg-color: #002c37;
17+
--md-footer-fg-color: #fdf6e3;
18+
--md-footer-bg-color: #0a3642;
1619
--md-footer-fg-color--light: #ffffff;
17-
--md-footer-bg-color--dark: #002c37;
20+
--md-footer-bg-color--dark: #0a3642;
1821
}
1922

2023
/* Dark mode */
@@ -24,14 +27,16 @@
2427

2528
--md-primary-bg-color: #fdf6e3;
2629
--md-primary-fg-color: #0a3642;
30+
--md-primary-fg-color--dark: #002c37;
31+
--md-primary-fg-color--light: #0a3642;
2732

2833
--md-accent-fg-color: #d56564;
2934
--md-accent-bg-color: #002c37;
3035

3136
--md-code-fg-color: #ffffff;
3237
--md-code-bg-color: #0a3642;
3338

34-
--md-footer-fg-color: #002c37;
39+
--md-footer-fg-color: #fdf6e3;
3540
--md-footer-bg-color: #002c37;
3641
--md-footer-fg-color--light: #ffffff;
3742
--md-footer-bg-color--dark: #0a3642;

synalinks/src/datasets/gsm8k.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
2+
13
import numpy as np
24
from datasets import load_dataset
35

synalinks/src/datasets/hotpotqa.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# License Apache 2.0: (c) 2025 Yoan Sallami (Synalinks Team)
2+
3+
import numpy as np
4+
from datasets import load_dataset
5+
6+
from synalinks.src.api_export import synalinks_export
7+
from synalinks.src.backend import DataModel
8+
from synalinks.src.backend import Field
9+
10+
# TODO

0 commit comments

Comments
 (0)