Skip to content

Commit 9201dd2

Browse files
kiberguscopybara-github
authored andcommitted
Fix principles.md formatting.
PiperOrigin-RevId: 882549512
1 parent 6934e64 commit 9201dd2

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

documentation/docs/principles.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ same time, techniques like constrained decoding allow forcing models to produce
3434
strictly structured, type-safe outputs. In this new landscape, the distinction
3535
between a schema-less model and a strongly-typed tool is quickly disappearing.
3636

37-
<details>
37+
<details markdown>
3838
<summary>The Shift in Practice: Where Rigid APIs Fall Short</summary>
39+
3940
Here is how that tension manifests in real-world scenarios:
4041

4142
* **Models acting as tools:** Can a lightweight model like gemini-flash-lite
@@ -47,8 +48,12 @@ Here is how that tension manifests in real-world scenarios:
4748
[Nano Banana be plugged as a tool](https://github.com/google-gemini/genai-processors/tree/main/examples/widgets)?
4849
Can its instructions include images?
4950

50-
* **Balanced Infrastructure:** Since most users only need a simple "string-in, string-out" API, how do we build a foundation that supports basic users without limiting advanced developers? Can one architecture effectively cater to both?
51-
</details>
51+
* **Balanced Infrastructure:** Since most users only need a simple "string-in,
52+
string-out" API, how do we build a foundation that supports basic users
53+
without limiting advanced developers? Can one architecture effectively cater
54+
to both?
55+
56+
</details>
5257

5358
This fragmentation is not inevitable. It is the result of how systems naturally
5459
evolved along the path of least resistance. We propose an approach based on
@@ -197,7 +202,7 @@ A Processor needs to balance two different needs: it must be easy to call (for
197202
the user) and easy to implement (for the developer). We achieve this by
198203
splitting the interface:
199204

200-
```
205+
```python
201206
class MyProcessor(Processor):
202207
# The CONSUMER Interface:
203208
# Designed for the caller. It is permissive with inputs and
@@ -243,7 +248,7 @@ print(
243248
If we were to expect the answer to actually be a bit longer and were anxious to
244249
learn the wisdom, we probably would have written
245250

246-
```
251+
```python
247252
async for part in model('Answer to...'):
248253
print(part.text, end='')
249254
```
@@ -252,7 +257,7 @@ To add more functionality while keeping the code structured, processors can be
252257
chained using `+`. For instance, if the model doesn't have native audio support,
253258
we can prepend a speech-to-text stage and a microphone input:
254259

255-
```
260+
```python
256261
from genai_processors.core import audio_io
257262
from genai_processors.core import speech_to_text
258263

@@ -263,7 +268,7 @@ And if we need to move beyond linear chains, we can use good old Python control
263268
flow. For instance, let's squeeze some extra quality by using a critic-reviser
264269
pattern:
265270

266-
```
271+
```python
267272
class CriticReviser(processor.Processor):
268273
"""Agent that uses a critic-reviser loop to improve responses."""
269274

documentation/hooks.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33

44

55
def on_post_build(config, **kwargs):
6-
"""Copy llms.txt to the site build directory."""
6+
"""Copy extra assets to the site build directory."""
77
base_dir = os.path.dirname(os.path.dirname(config['config_file_path']))
8-
src = os.path.join(base_dir, 'llms.txt')
9-
dest = os.path.join(config['site_dir'], 'llms.txt')
10-
if os.path.exists(src):
11-
shutil.copyfile(src, dest)
8+
docs_dir = config['docs_dir']
9+
site_dir = config['site_dir']
10+
11+
extra_files = [
12+
(os.path.join(base_dir, 'llms.txt'), os.path.join(site_dir, 'llms.txt')),
13+
(
14+
os.path.join(docs_dir, 'producer_consumer.svg'),
15+
os.path.join(site_dir, 'producer_consumer.svg'),
16+
),
17+
]
18+
for src, dest in extra_files:
19+
if os.path.exists(src):
20+
shutil.copyfile(src, dest)

0 commit comments

Comments
 (0)