Modules
Modules
In Guide 3 we treated a Program as a flowchart made of Modules. So
far the only module you have seen up close is Generator. This guide
introduces the rest of the catalogue — the bricks you snap together to
build interesting programs.
The mental picture is, once again, Lego. Every module is a single brick. It takes one structured piece of data in, produces one structured piece of data out, and snaps together with other bricks. A program is what you get when you click many bricks together.
A slightly more formal way to say it: a module is an asynchronous
function f: DataModel -> DataModel. Asynchronous just means the
function is defined with async def, so it can wait for slow
operations like an LM call without freezing the rest of the program. A
DataModel (you met it in Guide 2) is a Pydantic-based class that
pins down which fields exist and what type each one is.
Some modules carry trainable state — JSON objects that the
optimizer is allowed to rewrite during training. Each trainable
variable obeys a fixed schema (a subclass of synalinks.Trainable
— Guide 12 shows you how to write your own). The two most common
shapes for that JSON object are:
instructions— a variable whose primary field is the system prompt the module sends to the LM, andexamples— a variable whose primary field is a list of few-shot examples demonstrating the task.
These are special cases. A trainable variable can in general hold any structured data its schema describes — a persona, a configuration record, a small knowledge base, anything you can express as a Pydantic class. The important thing to internalize is that these variables are parameters of the module, not constants you hard-code. In a neural network, the parameters are floating-point weights; here, they are JSON objects. The optimizer's job is to improve them. Treat them accordingly.
A Program, recall, is a DAG (a directed acyclic graph — a flowchart
with no cycles) whose nodes are modules and whose arrows carry
DataModels. Synalinks checks types twice: once when you wire the
graph (using SymbolicDataModel, the schema-only stand-in for a real
value), and again at runtime when a real value flows through (using
ordinary Pydantic validation).
The split between schema (the static type — known at construction time) and value (the actual runtime instance) is the central idea. Everything below follows from it.
Core Modules
Input: the entry node
Input declares where data enters the graph. It performs no
computation. Its only job is to give the graph a typed entry point, the
same way the parameter list of a function tells you what arguments to
expect.
import synalinks
class Query(synalinks.DataModel):
query: str = synalinks.Field(description="User question")
# Declares a typed entry. No work happens here.
inputs = synalinks.Input(data_model=Query)
A useful analogy: Input plays the same role as the parameter list of
a Python function. def f(x): names x so the body can refer to it;
Input(data_model=Query) names a slot in the graph so everything
downstream can refer to it.
Generator: calling a language model with a typed output
Generator is the only module that talks to a language model
directly. It turns its input DataModel into a prompt, asks the model
to fill in the output DataModel, and returns a validated instance.
Two terms used below, worth pinning down:
- JSON schema: a JSON document that describes the shape of other JSON — which fields exist, what type each one is, which are required. Every Synalinks DataModel comes with one automatically.
- Constrained decoding: when the LM produces output, it is restricted token by token to choices that keep the output valid against the schema. Tokens that would break the schema are simply not allowed to come out. The result is JSON that parses, every time.
graph LR
A["Input DataModel"] --> B["Generator"]
B --> C["Prompt construction"]
C --> D["LM call"]
D --> E["Constrained decoding"]
E --> F["Pydantic validation"]
F --> G["Output DataModel"]
import synalinks
class Answer(synalinks.DataModel):
answer: str = synalinks.Field(description="The answer")
outputs = await synalinks.Generator(
data_model=Answer,
language_model=language_model,
instructions="Be concise and accurate.",
)(inputs)
Three rules to memorize:
- The output is either valid or you get an exception. A
Generatornever returns a half-built object. Either it matches the schema, or it raises. There is no silent truncation. - The prompt is built from the schema. Field names and their
descriptionstrings end up in the prompt. Rename a field or rewrite a description and you change the model's behavior, even if no other code changed. instructionsis a parameter, not a constant. A Synalinks optimizer can rewrite it during training, in the same way gradient descent rewrites a weight in a neural network.
Two common ways this goes wrong: empty or vague description strings
leave the model with too little to work with, and very deeply nested
schemas make constrained decoding more likely to fail on weaker models.
Identity: a placeholder that passes data through
Identity returns its input unchanged. It is the mathematical
identity function f(x) = x, expressed as a module. You use it to
keep graphs symmetric: when one branch transforms the data and a
parallel branch should leave it alone, Identity fills the slot so
you do not need a special case for "no module here."
Tool: turning a Python function into a module
Tool wraps an async Python function so an agent can call it. The
wrapper reads the function's signature and docstring to build a JSON
schema, which is the format that providers like OpenAI, Anthropic, and
Gemini expect when you declare a tool the model is allowed to call.
import synalinks
@synalinks.saving.register_synalinks_serializable()
async def search_web(query: str):
"""Search the web for information.
Args:
query (str): The search query.
"""
return {"results": [...]}
tool = synalinks.Tool(search_web)
Two rules to remember; these come from the LM providers (OpenAI/Anthropic/etc.), not from Synalinks itself:
- Every parameter must be required. Tool-calling providers treat
every declared parameter as required, so Python default values are
rejected. If a parameter is conceptually optional, model that
explicitly — for example, have callers pass
""orNoneand treat that value as "absent" inside the function. - Every parameter needs an entry under
Args:in the docstring. That text becomes the parameter'sdescriptionin the JSON schema. Forgetting one raises aValueErrorwhen you wrap the function (so you catch it early), not later when an agent tries to call the tool.
Control-Flow Modules
These modules give your program the LM equivalent of if, elif, and
switch. Use them when the next step of the flowchart needs to
depend on what the data actually looks like. This guide covers them
one brick at a time; Guide 5 shows how to compose them with the
merging operators into routing, fan-out, and fallback patterns.
Decision: pick one label from a fixed list
Decision asks the LM to pick exactly one label from a closed
set of choices that you supply. ("Closed" means the model is not
allowed to invent a new one.) The output schema is fixed:
{"choice": <one of labels>}. Conceptually, Decision is the LM
version of an if/elif chain where the condition is "what kind of
input is this?"
graph LR
A["Input"] --> B["Decision"]
B --> C{"Which label?"}
C -->|"math"| D["math"]
C -->|"general"| E["general"]
C -->|"code"| F["code"]
decision = await synalinks.Decision(
question="What type of question is this?",
labels=["math", "general", "code"],
language_model=language_model,
)(inputs)
# decision is a DataModel with a single field "choice".
Because constrained decoding enforces the label set, the result is
guaranteed to be one of your labels. If you want a free-form
category instead, use an ordinary Generator whose output schema
contains a string field.
Branch: classify, then route
Branch is the combination of a Decision and a k-way switch (a
switch/case statement with k possible paths). It returns a
tuple of k outputs, one slot per branch. At runtime, only the
branch picked by the classifier actually runs; the other k − 1
slots come back as None.
(math_output, general_output) = await synalinks.Branch(
question="Is this a math or general question?",
labels=["math", "general"],
branches=[
synalinks.Generator(
data_model=Answer,
language_model=lm,
instructions="You are a math expert.",
),
synalinks.Generator(
data_model=Answer,
language_model=lm,
instructions="You are a general knowledge expert.",
),
],
language_model=lm,
)(inputs)
# Collapse the tuple to a single output via Or.
outputs = math_output | general_output
What happens, step by step:
- The classifier picks an index
ibetween 0 and k − 1. - Branch number
iruns; the other branches skip and yieldNone. - Code downstream must cope with
Nonefrom the skipped branches. The usual way to do that is theOroperator (|) you will meet in a moment, which returns the first operand that is notNone.
Action: let the LM call one specific tool
Action is the bridge between a typed input and a Tool call. You
give it a single Tool and a LanguageModel; at call time, the LM
reads the input DataModel, infers the tool's arguments from it, and
the framework actually runs the tool. The output bundles together
the arguments the LM produced and the value the tool returned.
Think of Action as a single-tool, single-shot version of a
function-calling agent: there is no loop, no choice between tools —
just "given this input, fill in this tool's arguments and run it."
@synalinks.saving.register_synalinks_serializable()
async def calculate(expression: str):
"""Calculate a math expression.
Args:
expression (str): A math expression such as '2 + 2'.
"""
return {"result": eval(expression, {"__builtins__": None}, {})}
outputs = await synalinks.Action(
tool=synalinks.Tool(calculate),
language_model=language_model,
)(inputs)
Merging Modules
A merging module takes several DataModels and combines them into one.
What separates the four merging modules from each other is how they
react to two specific situations: (1) one of the inputs is missing
(it is None), and (2) two inputs both declare a field with the same
name (a schema collision).
graph LR
A["DataModel A"] --> C["Merge module"]
B["DataModel B"] --> C
C --> D["Combined DataModel"]
The four operators form a small algebra. The table below is a lookup chart: pick the row for the operator, then the column for which inputs are missing, and read what happens. "Union fields" means the result keeps every field from every input; "drop A" means A's fields are left out of the result.
| Operator | Symbol | A=None | B=None | both present |
|---|---|---|---|---|
| Concat | + |
drop A | drop B | union fields |
| And | & |
None | None | union fields |
| Or | \| |
B | A | A |
| Xor | ^ |
B | A | None |
Concat (+)
Combines the fields of every non-None input into one DataModel. When
two inputs use the same field name, Synalinks renames the duplicates by
appending a numeric suffix (answer, answer_1, answer_2, ...) so
no information is lost.
And (&)
Behaves like Concat when every input is present, but if any input is
None, the whole result is None. Use this when every branch is a
prerequisite for what comes next: missing any one means the next stage
should not run.
Or (|)
Returns the first input that is not None. This is the standard way to
collapse a Branch back into a single output.
Xor (^)
Stands for "exclusive or". Returns None when both inputs are present.
This is useful as a guard: if a warning fires (so both the warning and
the data are present), the data path is suppressed.
Masking Modules
Masking selects a subset of the fields of a DataModel. InMask keeps
only the fields you list (a whitelist); OutMask removes the fields
you list (a blacklist). In both cases the original DataModel is left
untouched, and a new DataModel with fewer fields is returned.
InMask
OutMask
Why narrowing fields matters:
- Smaller prompts. Generators further down the graph receive less text, which means fewer tokens and lower cost.
- Information hiding. A scratch field (for example
thinking) used for intermediate work does not need to appear in the final output. - Cleaner training. When the reward function only scores a subset of fields, the optimizer gets a clearer signal about what to improve.
Test-Time Compute Modules
These modules spend extra LM work when you run the program, in exchange for better accuracy — trading speed for quality. "Test-time" is a term borrowed from machine learning: it means "at the time the model is being used," as opposed to "training-time," when weights or prompts are being adjusted.
ChainOfThought
A chain of thought is a sequence of reasoning steps the model writes out before committing to an answer — the LM equivalent of "showing your work" on a math problem.
ChainOfThought adds a thinking field to the output schema, placed
before the fields you defined. Constrained decoders emit fields in
the order they appear in the schema, so the model writes the
reasoning first and the answer second. And because LMs generate one
token at a time — each token conditioned on the ones already written
— putting the reasoning before the answer means the answer ends up
conditioned on the reasoning. That tiny ordering trick is the entire
mechanism behind chain-of-thought prompting.
outputs = await synalinks.ChainOfThought(
data_model=Answer,
language_model=language_model,
)(inputs)
print(result['thinking'])
print(result['answer'])
You do not add thinking to your DataModel yourself. The
ChainOfThought module inserts it for you. This is the main reason
field order matters in Synalinks — order changes behavior, not just
appearance.
SelfCritique
Generates an answer, then scores it with a reward function, and returns both the answer and the score. A downstream module can use the score to decide whether to accept the answer, retry, or escalate to a stronger model.
Complete Example
import asyncio
from dotenv import load_dotenv
import synalinks
# =============================================================================
# Data Models
# =============================================================================
class Query(synalinks.DataModel):
"""User question."""
query: str = synalinks.Field(description="User question")
class Answer(synalinks.DataModel):
"""Simple answer."""
answer: str = synalinks.Field(description="The answer")
class AnswerWithThinking(synalinks.DataModel):
"""Answer with reasoning."""
thinking: str = synalinks.Field(description="Step by step thinking")
answer: str = synalinks.Field(description="The final answer")
# =============================================================================
# Main
# =============================================================================
async def main():
load_dotenv()
synalinks.clear_session()
lm = synalinks.LanguageModel(model="ollama/mistral:latest")
# -------------------------------------------------------------------------
# Generator
# -------------------------------------------------------------------------
print("=" * 60)
print("Module 1: Generator")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
outputs = await synalinks.Generator(
data_model=Answer,
language_model=lm,
)(inputs)
program = synalinks.Program(inputs=inputs, outputs=outputs)
result = await program(Query(query="What is Python?"))
print(f"Generator output: {result['answer'][:100]}...")
# -------------------------------------------------------------------------
# Branch
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 2: Branch")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
(math_out, general_out) = await synalinks.Branch(
question="Is this a math or general question?",
labels=["math", "general"],
branches=[
synalinks.Generator(
data_model=Answer,
language_model=lm,
instructions="Show your calculations.",
),
synalinks.Generator(
data_model=Answer,
language_model=lm,
),
],
language_model=lm,
)(inputs)
outputs = math_out | general_out
program = synalinks.Program(inputs=inputs, outputs=outputs)
result = await program(Query(query="What is 15 * 23?"))
print(f"Math result: {result['answer']}")
# -------------------------------------------------------------------------
# ChainOfThought
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 3: ChainOfThought")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
outputs = await synalinks.ChainOfThought(
data_model=Answer,
language_model=lm,
)(inputs)
program = synalinks.Program(inputs=inputs, outputs=outputs)
result = await program(Query(query="If I have 3 apples and give 1 away?"))
print(f"Thinking: {result['thinking'][:100]}...")
print(f"Answer: {result['answer']}")
# -------------------------------------------------------------------------
# Masking
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 4: Masking")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
full_output = await synalinks.Generator(
data_model=AnswerWithThinking,
language_model=lm,
)(inputs)
masked = await synalinks.InMask(mask=["answer"])(full_output)
program = synalinks.Program(inputs=inputs, outputs=masked)
result = await program(Query(query="What is 1+1?"))
print(f"Masked fields: {list(result.get_json().keys())}")
if __name__ == "__main__":
asyncio.run(main())
Expected output (with ollama/mistral:latest; LM outputs are
non-deterministic, so exact strings will vary):
============================================================
Module 1: Generator
============================================================
Generator output: Python is a high-level, interpreted programming language that is widely used for various purposes su...
============================================================
Module 2: Decision
============================================================
Decision output: calculation
Decision output: factual
============================================================
Module 3: Branch (includes decision-making)
============================================================
Math branch result: 345
General branch result: William Shakespeare
============================================================
Module 4: ChainOfThought
============================================================
Thinking: To find out how many apples you will have left after giving 1 away, we need to subtract 1 from the t...
Answer: 2
============================================================
Module 5: Concat (Merging)
============================================================
Merged fields: ['answer', 'thinking', 'answer_1']
============================================================
Module 6: InMask and OutMask
============================================================
Masked output fields: ['answer']
Answer: 2
Take-Home Summary
Inputdeclares the entry type. It does no work.Generatoris the only module that calls a language model. Its prompt is determined entirely by the input and output schemas plus the trainableinstructionsvariable (a JSON object whose primary field is the system-prompt text).DecisionandBranchgive you safe, fixed-size control flow. Because the labels are a closed set, the choice is always one you named — the model cannot invent a new category at runtime.Concat,And,Or,Xorare four ways to merge DataModels. Pick one by deciding how it should treat missing inputs.InMaskandOutMasknarrow a schema without changing the original DataModel.ChainOfThoughtuses the order of fields in the schema to make the model reason before it answers. In Synalinks, field order is part of the behavior.
API References
Answer
AnswerWithThinking
Bases: DataModel
Answer with reasoning.
Source code in guides/4_modules.py
Source
import asyncio
from dotenv import load_dotenv
import synalinks
# =============================================================================
# Data Models
# =============================================================================
class Query(synalinks.DataModel):
"""User question."""
query: str = synalinks.Field(description="User question")
class Answer(synalinks.DataModel):
"""Simple answer."""
answer: str = synalinks.Field(description="The answer")
class AnswerWithThinking(synalinks.DataModel):
"""Answer with reasoning."""
thinking: str = synalinks.Field(description="Step by step thinking")
answer: str = synalinks.Field(description="The final answer")
# =============================================================================
# Main Demonstration
# =============================================================================
async def main():
load_dotenv()
synalinks.clear_session()
synalinks.enable_logging()
# synalinks.enable_observability(
# tracking_uri="http://localhost:5000",
# experiment_name="guide_4_modules",
# )
lm = synalinks.LanguageModel(model="ollama/mistral:latest")
# -------------------------------------------------------------------------
# Generator Module
# -------------------------------------------------------------------------
print("=" * 60)
print("Module 1: Generator")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
outputs = await synalinks.Generator(
data_model=Answer,
language_model=lm,
)(inputs)
program = synalinks.Program(
inputs=inputs,
outputs=outputs,
name="generator_demo",
)
program.summary()
result = await program(Query(query="What is Python?"))
print(f"\nGenerator output: {result['answer'][:100]}...")
# -------------------------------------------------------------------------
# Decision Module
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 2: Decision")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
decision = await synalinks.Decision(
question="What type of query is this?",
labels=["factual", "opinion", "calculation"],
language_model=lm,
)(inputs)
decision_program = synalinks.Program(
inputs=inputs,
outputs=decision,
name="decision_demo",
)
decision_program.summary()
result = await decision_program(Query(query="What is 2+2?"))
print(f"\nDecision output: {result['choice']}")
result = await decision_program(Query(query="Is Python a good language?"))
print(f"Decision output: {result['choice']}")
# -------------------------------------------------------------------------
# Branch Module
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 3: Branch (includes decision-making)")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
# Branch combines decision-making with routing
(math_output, general_output) = await synalinks.Branch(
question="Is this a math or general question?",
labels=["math", "general"],
branches=[
synalinks.Generator(
data_model=Answer,
language_model=lm,
instructions="You are a math expert. Show your calculations.",
),
synalinks.Generator(
data_model=Answer,
language_model=lm,
instructions="You are a general knowledge expert.",
),
],
language_model=lm,
)(inputs)
# Use OR to combine - only selected branch produces output
outputs = math_output | general_output
branch_program = synalinks.Program(
inputs=inputs,
outputs=outputs,
name="branch_demo",
)
branch_program.summary()
result = await branch_program(Query(query="What is 15 * 23?"))
print(f"\nMath branch result: {result['answer']}")
result = await branch_program(Query(query="Who wrote Hamlet?"))
print(f"General branch result: {result['answer']}")
# -------------------------------------------------------------------------
# ChainOfThought Module
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 4: ChainOfThought")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
outputs = await synalinks.ChainOfThought(
data_model=Answer,
language_model=lm,
)(inputs)
cot_program = synalinks.Program(
inputs=inputs,
outputs=outputs,
name="cot_demo",
)
cot_program.summary()
result = await cot_program(Query(query="If I have 3 apples and give 1 away?"))
print(f"\nThinking: {result['thinking'][:100]}...")
print(f"Answer: {result['answer']}")
# -------------------------------------------------------------------------
# Merging Modules
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 5: Concat (Merging)")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
branch_a = await synalinks.Generator(
data_model=Answer,
language_model=lm,
name="expert_a",
instructions="You are expert A, brief answers.",
)(inputs)
branch_b = await synalinks.Generator(
data_model=AnswerWithThinking,
language_model=lm,
name="expert_b",
instructions="You are expert B, detailed answers.",
)(inputs)
merged = await synalinks.Concat()([branch_a, branch_b])
merge_program = synalinks.Program(
inputs=inputs,
outputs=merged,
name="merge_demo",
)
merge_program.summary()
result = await merge_program(Query(query="What is AI?"))
print(f"\nMerged fields: {list(result.get_json().keys())}")
# -------------------------------------------------------------------------
# Masking Modules
# -------------------------------------------------------------------------
print("\n" + "=" * 60)
print("Module 6: InMask and OutMask")
print("=" * 60)
inputs = synalinks.Input(data_model=Query)
full_output = await synalinks.Generator(
data_model=AnswerWithThinking,
language_model=lm,
)(inputs)
masked = await synalinks.InMask(mask=["answer"])(full_output)
mask_program = synalinks.Program(
inputs=inputs,
outputs=masked,
name="mask_demo",
)
mask_program.summary()
result = await mask_program(Query(query="What is 1+1?"))
print(f"\nMasked output fields: {list(result.get_json().keys())}")
print(f"Answer: {result['answer']}")
if __name__ == "__main__":
asyncio.run(main())
Run log
This guide calls synalinks.enable_logging(), so a full run traces every
module call. The log below is the unedited output of running the guide
above with local models.
Full run log — guides/4_modules.log
(DEBUG) [Synalinks]
Call ID: 1cfa0ef5-0aed-464e-b20a-55a748621c55
Parent call ID: None
Module: Generator
Module Name: generator
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 1cfa0ef5-0aed-464e-b20a-55a748621c55
Parent call ID: None
Module: Generator
Module Name: generator
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
============================================================
Module 1: Generator
============================================================
Program: generator_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Module (type) ┃ Output Schema ┃ Vars # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ input_module (InputModule) │ Query: │ 0 │
│ │ query: str │ │
├─────────────────────────────┼──────────────────────────────────┼─────────┤
│ generator (Generator) │ Answer: │ 1 │
│ │ answer: str │ │
└─────────────────────────────┴──────────────────────────────────┴─────────┘
[Synalinks]
Call ID: 8ab9f176-3f12-4ee6-8600-22bf6d2a99d5
Parent call ID: None
Module: Functional
Module Name: generator_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "What is Python?"
}
]
[Synalinks]
Call ID: da44b4be-52cd-4614-adcf-abac7fd3e107
Parent call ID: 8ab9f176-3f12-4ee6-8600-22bf6d2a99d5
Module: Generator
Module Name: generator
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is Python?"
}
]
[Synalinks]
Call ID: 9423fb3a-aa41-4b39-9137-6376f4adb099
Parent call ID: da44b4be-52cd-4614-adcf-abac7fd3e107
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYour task is to answer with a JSON containing the following keys: ['answer']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is Python?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: 9423fb3a-aa41-4b39-9137-6376f4adb099
Parent call ID: da44b4be-52cd-4614-adcf-abac7fd3e107
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"answer": "Python is a high-level, interpreted programming language that supports multiple programming paradigms, including procedural, object-oriented, and functional programming."
}
]
[Synalinks]
Call ID: da44b4be-52cd-4614-adcf-abac7fd3e107
Parent call ID: 8ab9f176-3f12-4ee6-8600-22bf6d2a99d5
Module: Generator
Module Name: generator
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"answer": "Python is a high-level, interpreted programming language that supports multiple programming paradigms, including procedural, object-oriented, and functional programming."
}
]
[Synalinks]
Call ID: 8ab9f176-3f12-4ee6-8600-22bf6d2a99d5
Parent call ID: None
Module: Functional
Module Name: generator_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"answer": "Python is a high-level, interpreted programming language that supports multiple programming paradigms, including procedural, object-oriented, and functional programming."
}
]
(DEBUG) [Synalinks]
Call ID: 7f507400-d863-4d49-8fef-29aaf7eca789
Parent call ID: None
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 66453f3d-a7ea-4f54-8b5a-fb3e01e73455
Parent call ID: 7f507400-d863-4d49-8fef-29aaf7eca789
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"question": {
"description": "The question to ask yourself.",
"title": "Question",
"type": "string"
}
},
"required": [
"query",
"question"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 66453f3d-a7ea-4f54-8b5a-fb3e01e73455
Parent call ID: 7f507400-d863-4d49-8fef-29aaf7eca789
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"factual",
"opinion",
"calculation"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 52c9cea7-a5da-4282-86dd-7b2fa91844f6
Parent call ID: 66453f3d-a7ea-4f54-8b5a-fb3e01e73455
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"question": {
"description": "The question to ask yourself.",
"title": "Question",
"type": "string"
}
},
"required": [
"query",
"question"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 52c9cea7-a5da-4282-86dd-7b2fa91844f6
Parent call ID: 66453f3d-a7ea-4f54-8b5a-fb3e01e73455
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"factual",
"opinion",
"calculation"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 7f507400-d863-4d49-8fef-29aaf7eca789
Parent call ID: None
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"factual",
"opinion",
"calculation"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
Generator output: Python is a high-level, interpreted programming language that supports multiple programming paradigm...
============================================================
Module 2: Decision
============================================================
Program: decision_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Module (type) ┃ Output Schema ┃ Vars # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ input_module_1 │ Query: │ 0 │
│ (InputModule) │ query: str │ │
├─────────────────────────────┼──────────────────────────────────┼─────────┤
│ decision (Decision) │ DecisionAnswer: │ 1 │
│ │ thinking: str │ │
│ │ choice: Literal['factual', │ │
│ │ 'opinion', 'calculation'] │ │
└─────────────────────────────┴──────────────────────────────────┴─────────┘
[Synalinks]
Call ID: 36f824e3-d449-403a-88ad-bf0ebe17757f
Parent call ID: None
Module: Functional
Module Name: decision_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "What is 2+2?"
}
]
[Synalinks]
Call ID: 15fe0956-54f3-4036-8491-58d8e30da26a
Parent call ID: 36f824e3-d449-403a-88ad-bf0ebe17757f
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"query": "What is 2+2?"
}
]
[Synalinks]
Call ID: 2cae552e-fb94-4bbc-8112-2f24440138a4
Parent call ID: 15fe0956-54f3-4036-8491-58d8e30da26a
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is 2+2?",
"question": "What type of query is this?"
}
]
[Synalinks]
Call ID: 2a295a33-019d-40b7-8b6b-8025f040b82c
Parent call ID: 2cae552e-fb94-4bbc-8112-2f24440138a4
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou will be given a question, your task is to answer step-by-step to choose\none the following labels: ['factual', 'opinion', 'calculation']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is 2+2?', 'question': 'What type of query is this?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: 2a295a33-019d-40b7-8b6b-8025f040b82c
Parent call ID: 2cae552e-fb94-4bbc-8112-2f24440138a4
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "This question asks for a mathematical calculation, so it falls under the 'calculation' category.",
"choice": "calculation"
}
]
[Synalinks]
Call ID: 2cae552e-fb94-4bbc-8112-2f24440138a4
Parent call ID: 15fe0956-54f3-4036-8491-58d8e30da26a
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "This question asks for a mathematical calculation, so it falls under the 'calculation' category.",
"choice": "calculation"
}
]
[Synalinks]
Call ID: 15fe0956-54f3-4036-8491-58d8e30da26a
Parent call ID: 36f824e3-d449-403a-88ad-bf0ebe17757f
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"thinking": "This question asks for a mathematical calculation, so it falls under the 'calculation' category.",
"choice": "calculation"
}
]
[Synalinks]
Call ID: 36f824e3-d449-403a-88ad-bf0ebe17757f
Parent call ID: None
Module: Functional
Module Name: decision_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"thinking": "This question asks for a mathematical calculation, so it falls under the 'calculation' category.",
"choice": "calculation"
}
]
[Synalinks]
Call ID: e5b8b7a6-af83-4f47-8492-6b5e201a4b40
Parent call ID: None
Module: Functional
Module Name: decision_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "Is Python a good language?"
}
]
[Synalinks]
Call ID: c5447480-6a16-4fb5-9274-3fe4c3ed171f
Parent call ID: e5b8b7a6-af83-4f47-8492-6b5e201a4b40
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"query": "Is Python a good language?"
}
]
[Synalinks]
Call ID: 57715271-34fb-42ea-aa24-6010078d6dc5
Parent call ID: c5447480-6a16-4fb5-9274-3fe4c3ed171f
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "Is Python a good language?",
"question": "What type of query is this?"
}
]
[Synalinks]
Call ID: 6e0e5e5c-b2e0-409a-a424-536ff06c06c9
Parent call ID: 57715271-34fb-42ea-aa24-6010078d6dc5
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou will be given a question, your task is to answer step-by-step to choose\none the following labels: ['factual', 'opinion', 'calculation']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'Is Python a good language?', 'question': 'What type of query is this?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: 6e0e5e5c-b2e0-409a-a424-536ff06c06c9
Parent call ID: 57715271-34fb-42ea-aa24-6010078d6dc5
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "The question is asking for an opinion or personal judgment, so it falls under the category of 'opinion'.",
"choice": "opinion"
}
]
[Synalinks]
Call ID: 57715271-34fb-42ea-aa24-6010078d6dc5
Parent call ID: c5447480-6a16-4fb5-9274-3fe4c3ed171f
Module: Generator
Module Name: generator_decision
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "The question is asking for an opinion or personal judgment, so it falls under the category of 'opinion'.",
"choice": "opinion"
}
]
[Synalinks]
Call ID: c5447480-6a16-4fb5-9274-3fe4c3ed171f
Parent call ID: e5b8b7a6-af83-4f47-8492-6b5e201a4b40
Module: Decision
Module Name: decision
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"thinking": "The question is asking for an opinion or personal judgment, so it falls under the category of 'opinion'.",
"choice": "opinion"
}
]
[Synalinks]
Call ID: e5b8b7a6-af83-4f47-8492-6b5e201a4b40
Parent call ID: None
Module: Functional
Module Name: decision_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"thinking": "The question is asking for an opinion or personal judgment, so it falls under the category of 'opinion'.",
"choice": "opinion"
}
]
(DEBUG) [Synalinks]
Call ID: a37650e0-4862-4f4d-8644-52c2807c693e
Parent call ID: None
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 8445647b-67b1-424a-ab60-282f97a69e82
Parent call ID: a37650e0-4862-4f4d-8644-52c2807c693e
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 29f3feb0-1854-4888-bcbb-2db9724d34df
Parent call ID: 8445647b-67b1-424a-ab60-282f97a69e82
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"question": {
"description": "The question to ask yourself.",
"title": "Question",
"type": "string"
}
},
"required": [
"query",
"question"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 29f3feb0-1854-4888-bcbb-2db9724d34df
Parent call ID: 8445647b-67b1-424a-ab60-282f97a69e82
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 125e10d4-9c3c-46b4-b544-2bba1853b051
Parent call ID: 29f3feb0-1854-4888-bcbb-2db9724d34df
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"question": {
"description": "The question to ask yourself.",
"title": "Question",
"type": "string"
}
},
"required": [
"query",
"question"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 125e10d4-9c3c-46b4-b544-2bba1853b051
Parent call ID: 29f3feb0-1854-4888-bcbb-2db9724d34df
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 8445647b-67b1-424a-ab60-282f97a69e82
Parent call ID: a37650e0-4862-4f4d-8644-52c2807c693e
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 6567ee8c-33b0-4cdd-aaf4-ab46791f0152
Parent call ID: 125e10d4-9c3c-46b4-b544-2bba1853b051
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"query",
"thinking",
"choice"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 6567ee8c-33b0-4cdd-aaf4-ab46791f0152
Parent call ID: 125e10d4-9c3c-46b4-b544-2bba1853b051
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 1a14b232-d1b2-4c72-8970-f4272f67ce94
Parent call ID: 6567ee8c-33b0-4cdd-aaf4-ab46791f0152
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"query",
"thinking",
"choice"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 1a14b232-d1b2-4c72-8970-f4272f67ce94
Parent call ID: 6567ee8c-33b0-4cdd-aaf4-ab46791f0152
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: b1ddd770-fe8b-4965-805b-754aaf6f73a2
Parent call ID: 1a14b232-d1b2-4c72-8970-f4272f67ce94
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: ce436cbd-ea98-465c-86ca-a78e69cd14a9
Parent call ID: b1ddd770-fe8b-4965-805b-754aaf6f73a2
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"question": {
"description": "The question to ask yourself.",
"title": "Question",
"type": "string"
}
},
"required": [
"query",
"question"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: ce436cbd-ea98-465c-86ca-a78e69cd14a9
Parent call ID: b1ddd770-fe8b-4965-805b-754aaf6f73a2
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: b1ddd770-fe8b-4965-805b-754aaf6f73a2
Parent call ID: 1a14b232-d1b2-4c72-8970-f4272f67ce94
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"thinking",
"choice"
],
"title": "DecisionAnswer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 00ac15ba-10f9-4354-bc2a-5a58d926f8b1
Parent call ID: ce436cbd-ea98-465c-86ca-a78e69cd14a9
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"query",
"thinking",
"choice"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 00ac15ba-10f9-4354-bc2a-5a58d926f8b1
Parent call ID: ce436cbd-ea98-465c-86ca-a78e69cd14a9
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 9a0fa9e2-3abb-4d52-9e34-908dde226ffe
Parent call ID: 00ac15ba-10f9-4354-bc2a-5a58d926f8b1
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
},
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
}
},
"required": [
"query",
"thinking",
"choice"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 9a0fa9e2-3abb-4d52-9e34-908dde226ffe
Parent call ID: 00ac15ba-10f9-4354-bc2a-5a58d926f8b1
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: a37650e0-4862-4f4d-8644-52c2807c693e
Parent call ID: None
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
},
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"choice",
"answer"
],
"title": "DecisionAnswer",
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking to choose the correct label.",
"title": "Thinking",
"type": "string"
},
"choice": {
"enum": [
"math",
"general"
],
"title": "Choice",
"type": "string"
},
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"choice",
"answer"
],
"title": "DecisionAnswer",
"type": "object"
}
]
Decision output: calculation
Decision output: opinion
============================================================
Module 3: Branch (includes decision-making)
============================================================
Program: branch_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ ┃ ┃ Vars ┃ ┃
┃ Module (type) ┃ Output Schema ┃ # ┃ Connected to ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ input_module_2 │ Query: │ 0 │ - │
│ (InputModule) │ query: str │ │ │
├────────────────────┼─────────────────────────┼───────┼───────────────────┤
│ branch (Branch) │ DecisionAnswer: │ 3 │ input_module_2[0… │
│ │ thinking: str │ │ │
│ │ choice: │ │ │
│ │ Literal['math', │ │ │
│ │ 'general'] │ │ │
│ │ answer: str │ │ │
│ │ --- │ │ │
│ │ DecisionAnswer: │ │ │
│ │ thinking: str │ │ │
│ │ choice: │ │ │
│ │ Literal['math', │ │ │
│ │ 'general'] │ │ │
│ │ answer: str │ │ │
├────────────────────┼─────────────────────────┼───────┼───────────────────┤
│ or (Or) │ DecisionAnswer: │ 0 │ branch[0][0], │
│ │ thinking: str │ │ branch[0][1] │
│ │ choice: │ │ │
│ │ Literal['math', │ │ │
│ │ 'general'] │ │ │
│ │ answer: str │ │ │
└────────────────────┴─────────────────────────┴───────┴───────────────────┘
[Synalinks]
Call ID: d3e7a883-794d-4ab0-a027-71d58e60b50f
Parent call ID: None
Module: Functional
Module Name: branch_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "What is 15 * 23?"
}
]
[Synalinks]
Call ID: 92b3cbda-9d13-411c-a1de-c71df46a82ce
Parent call ID: d3e7a883-794d-4ab0-a027-71d58e60b50f
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON:
[
{
"query": "What is 15 * 23?"
}
]
[Synalinks]
Call ID: cd4055b7-c80d-42ce-b545-962fd28b8056
Parent call ID: 92b3cbda-9d13-411c-a1de-c71df46a82ce
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"query": "What is 15 * 23?"
}
]
[Synalinks]
Call ID: 7cd4299d-8c8e-41f6-8ca1-3ef0607353cd
Parent call ID: cd4055b7-c80d-42ce-b545-962fd28b8056
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is 15 * 23?",
"question": "Is this a math or general question?"
}
]
[Synalinks]
Call ID: e07dbf32-3eb1-418c-88c5-a8073749d3f9
Parent call ID: 7cd4299d-8c8e-41f6-8ca1-3ef0607353cd
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou will be given a question, your task is to answer step-by-step to choose\none the following labels: ['math', 'general']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is 15 * 23?', 'question': 'Is this a math or general question?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: e07dbf32-3eb1-418c-88c5-a8073749d3f9
Parent call ID: 7cd4299d-8c8e-41f6-8ca1-3ef0607353cd
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math"
}
]
[Synalinks]
Call ID: 7cd4299d-8c8e-41f6-8ca1-3ef0607353cd
Parent call ID: cd4055b7-c80d-42ce-b545-962fd28b8056
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math"
}
]
[Synalinks]
Call ID: cd4055b7-c80d-42ce-b545-962fd28b8056
Parent call ID: 92b3cbda-9d13-411c-a1de-c71df46a82ce
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math"
}
]
[Synalinks]
Call ID: b7996255-9dd5-4674-840a-647230f8b737
Parent call ID: e07dbf32-3eb1-418c-88c5-a8073749d3f9
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is 15 * 23?",
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math"
}
]
[Synalinks]
Call ID: a03609f5-da58-4e46-9df6-345dc3cb34ec
Parent call ID: b7996255-9dd5-4674-840a-647230f8b737
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou are a math expert. Show your calculations.\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is 15 * 23?', 'thinking': \"The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.\", 'choice': 'math'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: a03609f5-da58-4e46-9df6-345dc3cb34ec
Parent call ID: b7996255-9dd5-4674-840a-647230f8b737
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"answer": "345"
}
]
[Synalinks]
Call ID: b7996255-9dd5-4674-840a-647230f8b737
Parent call ID: e07dbf32-3eb1-418c-88c5-a8073749d3f9
Module: Generator
Module Name: generator_1
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"answer": "345"
}
]
[Synalinks]
Call ID: 92b3cbda-9d13-411c-a1de-c71df46a82ce
Parent call ID: d3e7a883-794d-4ab0-a027-71d58e60b50f
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON:
[
{
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math",
"answer": "345"
}
]
[Synalinks]
Call ID: d3e7a883-794d-4ab0-a027-71d58e60b50f
Parent call ID: None
Module: Functional
Module Name: branch_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"thinking": "The given query involves multiplication of two numbers, which is a mathematical operation. Therefore, the label for this question would be 'math'.",
"choice": "math",
"answer": "345"
}
]
[Synalinks]
Call ID: 5fe2b41c-1134-45cd-94b2-1932df2bbb54
Parent call ID: None
Module: Functional
Module Name: branch_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "Who wrote Hamlet?"
}
]
[Synalinks]
Call ID: a9e9f699-1640-4d25-b2e9-bedd7e0ca1e5
Parent call ID: 5fe2b41c-1134-45cd-94b2-1932df2bbb54
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON:
[
{
"query": "Who wrote Hamlet?"
}
]
[Synalinks]
Call ID: a22e0b5b-0c2a-4fad-b090-2e2e874322a8
Parent call ID: a9e9f699-1640-4d25-b2e9-bedd7e0ca1e5
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"query": "Who wrote Hamlet?"
}
]
[Synalinks]
Call ID: 55441106-83f9-448b-9274-4b36a88ce338
Parent call ID: a22e0b5b-0c2a-4fad-b090-2e2e874322a8
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "Who wrote Hamlet?",
"question": "Is this a math or general question?"
}
]
[Synalinks]
Call ID: f732f322-ac90-42ee-8735-02cbb1d7e37c
Parent call ID: 55441106-83f9-448b-9274-4b36a88ce338
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou will be given a question, your task is to answer step-by-step to choose\none the following labels: ['math', 'general']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'Who wrote Hamlet?', 'question': 'Is this a math or general question?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: f732f322-ac90-42ee-8735-02cbb1d7e37c
Parent call ID: 55441106-83f9-448b-9274-4b36a88ce338
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general"
}
]
[Synalinks]
Call ID: 55441106-83f9-448b-9274-4b36a88ce338
Parent call ID: a22e0b5b-0c2a-4fad-b090-2e2e874322a8
Module: Generator
Module Name: generator_decision_branch
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general"
}
]
[Synalinks]
Call ID: a22e0b5b-0c2a-4fad-b090-2e2e874322a8
Parent call ID: a9e9f699-1640-4d25-b2e9-bedd7e0ca1e5
Module: Decision
Module Name: decision_branch
Module Description: Perform a decision on the given input based on a question and a list of labels.
Data Model JSON:
[
{
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general"
}
]
[Synalinks]
Call ID: b0d04f5e-3063-4415-8c16-9617d1e1aa1c
Parent call ID: f732f322-ac90-42ee-8735-02cbb1d7e37c
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "Who wrote Hamlet?",
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general"
}
]
[Synalinks]
Call ID: c8d8e633-ccc5-489f-84cf-84ba596fca1c
Parent call ID: b0d04f5e-3063-4415-8c16-9617d1e1aa1c
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou are a general knowledge expert.\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'Who wrote Hamlet?', 'thinking': \"The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.\", 'choice': 'general'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: c8d8e633-ccc5-489f-84cf-84ba596fca1c
Parent call ID: b0d04f5e-3063-4415-8c16-9617d1e1aa1c
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"answer": "William Shakespeare"
}
]
[Synalinks]
Call ID: b0d04f5e-3063-4415-8c16-9617d1e1aa1c
Parent call ID: f732f322-ac90-42ee-8735-02cbb1d7e37c
Module: Generator
Module Name: generator_2
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"answer": "William Shakespeare"
}
]
[Synalinks]
Call ID: a9e9f699-1640-4d25-b2e9-bedd7e0ca1e5
Parent call ID: 5fe2b41c-1134-45cd-94b2-1932df2bbb54
Module: Branch
Module Name: branch
Module Description: Use a `LanguageModel` to select which module(s) to call based on an
Data Model JSON:
[
{
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general",
"answer": "William Shakespeare"
}
]
[Synalinks]
Call ID: 5fe2b41c-1134-45cd-94b2-1932df2bbb54
Parent call ID: None
Module: Functional
Module Name: branch_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"thinking": "The question is asking for information about literature, not numbers or mathematical operations. Therefore, the correct label is 'general'.",
"choice": "general",
"answer": "William Shakespeare"
}
]
(DEBUG) [Synalinks]
Call ID: 71674a17-9627-4bde-be6a-18467fc24dc7
Parent call ID: None
Module: ChainOfThought
Module Name: chain_of_thought
Module Description: Useful to answer in a step by step manner.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 41fae7e0-ac0c-4a67-89d6-d7009d57a6f9
Parent call ID: 71674a17-9627-4bde-be6a-18467fc24dc7
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 41fae7e0-ac0c-4a67-89d6-d7009d57a6f9
Parent call ID: 71674a17-9627-4bde-be6a-18467fc24dc7
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "Thinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 448256f8-d0bf-45eb-b754-7249331b00dc
Parent call ID: 41fae7e0-ac0c-4a67-89d6-d7009d57a6f9
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 448256f8-d0bf-45eb-b754-7249331b00dc
Parent call ID: 41fae7e0-ac0c-4a67-89d6-d7009d57a6f9
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "Thinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 71674a17-9627-4bde-be6a-18467fc24dc7
Parent call ID: None
Module: ChainOfThought
Module Name: chain_of_thought
Module Description: Useful to answer in a step by step manner.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"thinking": {
"description": "Your step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "Thinking",
"type": "object"
}
]
Math branch result: 345
General branch result: William Shakespeare
============================================================
Module 4: ChainOfThought
============================================================
Program: cot_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Module (type) ┃ Output Schema ┃ Vars # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ input_module_3 │ Query: │ 0 │
│ (InputModule) │ query: str │ │
├─────────────────────────────┼──────────────────────────────────┼─────────┤
│ chain_of_thought │ Thinking: │ 1 │
│ (ChainOfThought) │ thinking: str │ │
│ │ answer: str │ │
└─────────────────────────────┴──────────────────────────────────┴─────────┘
[Synalinks]
Call ID: d95e7016-50c4-426b-b4a8-c1427b7406b7
Parent call ID: None
Module: Functional
Module Name: cot_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "If I have 3 apples and give 1 away?"
}
]
[Synalinks]
Call ID: 59de254f-39fb-4c89-9e25-96704ecde546
Parent call ID: d95e7016-50c4-426b-b4a8-c1427b7406b7
Module: ChainOfThought
Module Name: chain_of_thought
Module Description: Useful to answer in a step by step manner.
Data Model JSON:
[
{
"query": "If I have 3 apples and give 1 away?"
}
]
[Synalinks]
Call ID: 891422d9-fd50-4582-ae89-d026765ec480
Parent call ID: 59de254f-39fb-4c89-9e25-96704ecde546
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "If I have 3 apples and give 1 away?"
}
]
[Synalinks]
Call ID: a162d477-0c13-4c0e-ac6b-7d5d671aee01
Parent call ID: 891422d9-fd50-4582-ae89-d026765ec480
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYour task is to answer with a JSON containing the following keys: ['thinking', 'answer']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'If I have 3 apples and give 1 away?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: a162d477-0c13-4c0e-ac6b-7d5d671aee01
Parent call ID: 891422d9-fd50-4582-ae89-d026765ec480
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "The number of apples you have decreases by one if you give one away.",
"answer": "You will have 2 apples left."
}
]
[Synalinks]
Call ID: 891422d9-fd50-4582-ae89-d026765ec480
Parent call ID: 59de254f-39fb-4c89-9e25-96704ecde546
Module: Generator
Module Name: generator_chain_of_thought
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "The number of apples you have decreases by one if you give one away.",
"answer": "You will have 2 apples left."
}
]
[Synalinks]
Call ID: 59de254f-39fb-4c89-9e25-96704ecde546
Parent call ID: d95e7016-50c4-426b-b4a8-c1427b7406b7
Module: ChainOfThought
Module Name: chain_of_thought
Module Description: Useful to answer in a step by step manner.
Data Model JSON:
[
{
"thinking": "The number of apples you have decreases by one if you give one away.",
"answer": "You will have 2 apples left."
}
]
[Synalinks]
Call ID: d95e7016-50c4-426b-b4a8-c1427b7406b7
Parent call ID: None
Module: Functional
Module Name: cot_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"thinking": "The number of apples you have decreases by one if you give one away.",
"answer": "You will have 2 apples left."
}
]
(DEBUG) [Synalinks]
Call ID: 9bae7c9d-54b2-4f60-9a25-dd40979d7375
Parent call ID: None
Module: Generator
Module Name: expert_a
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 9bae7c9d-54b2-4f60-9a25-dd40979d7375
Parent call ID: None
Module: Generator
Module Name: expert_a
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: cd570918-7510-4fff-88e9-1b23cb029c38
Parent call ID: None
Module: Generator
Module Name: expert_b
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: cd570918-7510-4fff-88e9-1b23cb029c38
Parent call ID: None
Module: Generator
Module Name: expert_b
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Answer with reasoning.",
"properties": {
"thinking": {
"description": "Step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The final answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "AnswerWithThinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 0e3577d7-32f7-41e5-995b-01818eee69b4
Parent call ID: None
Module: Concat
Module Name: concat_1
Module Description: Perform a concatenation operation.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Simple answer.",
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "Answer",
"type": "object"
},
{
"additionalProperties": false,
"description": "Answer with reasoning.",
"properties": {
"thinking": {
"description": "Step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The final answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "AnswerWithThinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 0e3577d7-32f7-41e5-995b-01818eee69b4
Parent call ID: None
Module: Concat
Module Name: concat_1
Module Description: Perform a concatenation operation.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"properties": {
"answer": {
"description": "The answer",
"title": "Answer",
"type": "string"
},
"thinking": {
"description": "Step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer_1": {
"description": "The final answer",
"title": "Answer 1",
"type": "string"
}
},
"required": [
"answer",
"thinking",
"answer_1"
],
"title": "Answer",
"type": "object"
}
]
Thinking: The number of apples you have decreases by one if you give one away....
Answer: You will have 2 apples left.
============================================================
Module 5: Concat (Merging)
============================================================
Program: merge_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ ┃ ┃ Vars ┃ ┃
┃ Module (type) ┃ Output Schema ┃ # ┃ Connected to ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ input_module_4 │ Query: │ 0 │ - │
│ (InputModule) │ query: str │ │ │
├────────────────────┼─────────────────────────┼───────┼───────────────────┤
│ expert_a │ Answer: │ 1 │ input_module_4[0… │
│ (Generator) │ answer: str │ │ │
├────────────────────┼─────────────────────────┼───────┼───────────────────┤
│ expert_b │ AnswerWithThinking: │ 1 │ input_module_4[0… │
│ (Generator) │ thinking: str │ │ │
│ │ answer: str │ │ │
├────────────────────┼─────────────────────────┼───────┼───────────────────┤
│ concat_1 (Concat) │ Answer: │ 0 │ expert_a[0][0], │
│ │ answer: str │ │ expert_b[0][0] │
│ │ thinking: str │ │ │
│ │ answer_1: str │ │ │
└────────────────────┴─────────────────────────┴───────┴───────────────────┘
[Synalinks]
Call ID: 6040ff86-2fe3-4d30-b7d7-4e0d3e3475ac
Parent call ID: None
Module: Functional
Module Name: merge_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "What is AI?"
}
]
[Synalinks]
Call ID: ddf3ba88-f438-4f52-8923-ad7ba0e86dec
Parent call ID: 6040ff86-2fe3-4d30-b7d7-4e0d3e3475ac
Module: Generator
Module Name: expert_a
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is AI?"
}
]
[Synalinks]
Call ID: ead8ecac-6351-4876-bbb6-e525e9eaa196
Parent call ID: ddf3ba88-f438-4f52-8923-ad7ba0e86dec
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou are expert A, brief answers.\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is AI?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: a7b44650-167b-4824-9a07-2aa3b4ad4895
Parent call ID: ead8ecac-6351-4876-bbb6-e525e9eaa196
Module: Generator
Module Name: expert_b
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is AI?"
}
]
[Synalinks]
Call ID: d66b599b-29d9-4d05-b899-ff66fbbd2389
Parent call ID: a7b44650-167b-4824-9a07-2aa3b4ad4895
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYou are expert B, detailed answers.\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is AI?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: ead8ecac-6351-4876-bbb6-e525e9eaa196
Parent call ID: ddf3ba88-f438-4f52-8923-ad7ba0e86dec
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"answer": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans, enabling them to perform tasks without being explicitly programmed."
}
]
[Synalinks]
Call ID: ddf3ba88-f438-4f52-8923-ad7ba0e86dec
Parent call ID: 6040ff86-2fe3-4d30-b7d7-4e0d3e3475ac
Module: Generator
Module Name: expert_a
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"answer": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans, enabling them to perform tasks without being explicitly programmed."
}
]
[Synalinks]
Call ID: d66b599b-29d9-4d05-b899-ff66fbbd2389
Parent call ID: a7b44650-167b-4824-9a07-2aa3b4ad4895
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. It involves the development of computer systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns, solving problems, and making decisions.",
"answer": "Artificial Intelligence (AI) is a branch of computer science that aims to create intelligent machines capable of performing tasks that would normally require human intelligence. It includes the development of algorithms and models that enable computers to learn from data, make decisions, and solve complex problems."
}
]
[Synalinks]
Call ID: a7b44650-167b-4824-9a07-2aa3b4ad4895
Parent call ID: ead8ecac-6351-4876-bbb6-e525e9eaa196
Module: Generator
Module Name: expert_b
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. It involves the development of computer systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns, solving problems, and making decisions.",
"answer": "Artificial Intelligence (AI) is a branch of computer science that aims to create intelligent machines capable of performing tasks that would normally require human intelligence. It includes the development of algorithms and models that enable computers to learn from data, make decisions, and solve complex problems."
}
]
[Synalinks]
Call ID: 04cbaec4-6564-4fb7-a37f-a51109afa243
Parent call ID: d66b599b-29d9-4d05-b899-ff66fbbd2389
Module: Concat
Module Name: concat_1
Module Description: Perform a concatenation operation.
Data Model JSON:
[
{
"answer": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans, enabling them to perform tasks without being explicitly programmed."
},
{
"thinking": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. It involves the development of computer systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns, solving problems, and making decisions.",
"answer": "Artificial Intelligence (AI) is a branch of computer science that aims to create intelligent machines capable of performing tasks that would normally require human intelligence. It includes the development of algorithms and models that enable computers to learn from data, make decisions, and solve complex problems."
}
]
[Synalinks]
Call ID: 04cbaec4-6564-4fb7-a37f-a51109afa243
Parent call ID: d66b599b-29d9-4d05-b899-ff66fbbd2389
Module: Concat
Module Name: concat_1
Module Description: Perform a concatenation operation.
Data Model JSON:
[
{
"answer": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans, enabling them to perform tasks without being explicitly programmed.",
"thinking": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. It involves the development of computer systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns, solving problems, and making decisions.",
"answer_1": "Artificial Intelligence (AI) is a branch of computer science that aims to create intelligent machines capable of performing tasks that would normally require human intelligence. It includes the development of algorithms and models that enable computers to learn from data, make decisions, and solve complex problems."
}
]
[Synalinks]
Call ID: 6040ff86-2fe3-4d30-b7d7-4e0d3e3475ac
Parent call ID: None
Module: Functional
Module Name: merge_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"answer": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans, enabling them to perform tasks without being explicitly programmed.",
"thinking": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines that are programmed to think and learn like humans. It involves the development of computer systems that can perform tasks that typically require human intelligence, such as understanding natural language, recognizing patterns, solving problems, and making decisions.",
"answer_1": "Artificial Intelligence (AI) is a branch of computer science that aims to create intelligent machines capable of performing tasks that would normally require human intelligence. It includes the development of algorithms and models that enable computers to learn from data, make decisions, and solve complex problems."
}
]
(DEBUG) [Synalinks]
Call ID: 654370ae-0775-41ba-b58f-df363966eb06
Parent call ID: None
Module: Generator
Module Name: generator_3
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "User question.",
"properties": {
"query": {
"description": "User question",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "Query",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 654370ae-0775-41ba-b58f-df363966eb06
Parent call ID: None
Module: Generator
Module Name: generator_3
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Answer with reasoning.",
"properties": {
"thinking": {
"description": "Step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The final answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "AnswerWithThinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 5b5227af-3132-48f4-8f77-1c1a389a88e2
Parent call ID: None
Module: InMask
Module Name: in_mask
Module Description: A module to keep specific fields of the given data models
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Answer with reasoning.",
"properties": {
"thinking": {
"description": "Step by step thinking",
"title": "Thinking",
"type": "string"
},
"answer": {
"description": "The final answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"thinking",
"answer"
],
"title": "AnswerWithThinking",
"type": "object"
}
]
(DEBUG) [Synalinks]
Call ID: 5b5227af-3132-48f4-8f77-1c1a389a88e2
Parent call ID: None
Module: InMask
Module Name: in_mask
Module Description: A module to keep specific fields of the given data models
Data Model JSON Schema:
[
{
"additionalProperties": false,
"description": "Answer with reasoning.",
"properties": {
"answer": {
"description": "The final answer",
"title": "Answer",
"type": "string"
}
},
"required": [
"answer"
],
"title": "AnswerWithThinking",
"type": "object"
}
]
Merged fields: ['answer', 'thinking', 'answer_1']
============================================================
Module 6: InMask and OutMask
============================================================
Program: mask_demo
description: 'A `Functional` program is a `Program` defined as a directed graph
of modules.'
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Module (type) ┃ Output Schema ┃ Vars # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ input_module_5 │ Query: │ 0 │
│ (InputModule) │ query: str │ │
├─────────────────────────────┼──────────────────────────────────┼─────────┤
│ generator_3 (Generator) │ AnswerWithThinking: │ 1 │
│ │ thinking: str │ │
│ │ answer: str │ │
├─────────────────────────────┼──────────────────────────────────┼─────────┤
│ in_mask (InMask) │ AnswerWithThinking: │ 0 │
│ │ answer: str │ │
└─────────────────────────────┴──────────────────────────────────┴─────────┘
[Synalinks]
Call ID: a4f2a640-4f32-4e55-819f-eb94f437226a
Parent call ID: None
Module: Functional
Module Name: mask_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"query": "What is 1+1?"
}
]
[Synalinks]
Call ID: a301b4ef-6238-4396-b108-aaf6d2a464f0
Parent call ID: a4f2a640-4f32-4e55-819f-eb94f437226a
Module: Generator
Module Name: generator_3
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"query": "What is 1+1?"
}
]
[Synalinks]
Call ID: 489fad1d-47e9-4e3a-b4f1-01b29ad820e5
Parent call ID: a301b4ef-6238-4396-b108-aaf6d2a464f0
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"messages": [
{
"role": "system",
"content": "<instructions>\nYour task is to answer with a JSON containing the following keys: ['thinking', 'answer']\n</instructions>\n"
},
{
"role": "user",
"content": "<input>\n{'query': 'What is 1+1?'}\n</input>\n<output>\n"
}
]
}
]
[Synalinks]
Call ID: 489fad1d-47e9-4e3a-b4f1-01b29ad820e5
Parent call ID: a301b4ef-6238-4396-b108-aaf6d2a464f0
Module: LanguageModel
Module Name: language_model
Module Description: A language model API wrapper.
Data Model JSON:
[
{
"thinking": "Performing basic arithmetic",
"answer": "2"
}
]
[Synalinks]
Call ID: a301b4ef-6238-4396-b108-aaf6d2a464f0
Parent call ID: a4f2a640-4f32-4e55-819f-eb94f437226a
Module: Generator
Module Name: generator_3
Module Description: Use a `LanguageModel` to generate a data model from an arbitrary input data model.
Data Model JSON:
[
{
"thinking": "Performing basic arithmetic",
"answer": "2"
}
]
[Synalinks]
Call ID: 2d60a02f-ff86-4aa0-942c-77fcceb44799
Parent call ID: 489fad1d-47e9-4e3a-b4f1-01b29ad820e5
Module: InMask
Module Name: in_mask
Module Description: A module to keep specific fields of the given data models
Data Model JSON:
[
{
"thinking": "Performing basic arithmetic",
"answer": "2"
}
]
[Synalinks]
Call ID: 2d60a02f-ff86-4aa0-942c-77fcceb44799
Parent call ID: 489fad1d-47e9-4e3a-b4f1-01b29ad820e5
Module: InMask
Module Name: in_mask
Module Description: A module to keep specific fields of the given data models
Data Model JSON:
[
{
"answer": "2"
}
]
[Synalinks]
Call ID: a4f2a640-4f32-4e55-819f-eb94f437226a
Parent call ID: None
Module: Functional
Module Name: mask_demo
Module Description: A `Functional` program is a `Program` defined as a directed graph of modules.
Data Model JSON:
[
{
"answer": "2"
}
]
Masked output fields: ['answer']
Answer: 2