Input module
Input(schema=None, data_model=None, optional=False, name=None)
Used to instantiate a SymbolicDataModel
.
A SymbolicDataModel
is a symbolic data_model-like object, which we augment with
certain attributes that allow us to build a Synalinks Program
just by knowing the
inputs and outputs of the program.
Example:
import synalinks
class Query(synalinks.DataModel):
query: str
inputs = synalinks.Input(data_model=Query)
# You can also create it using a JSON schema like this:
inputs = synalinks.Input(schema=Query.schema())
# Or using a symbolic datamodel:
inputs = synalinks.Input(data_model=Query.to_symbolic_data_model())
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
dict
|
A Json schema of the data_model.
If not provided uses the |
None
|
data_model
|
DataModel
|
Optional existing data model to wrap into
the |
None
|
optional
|
bool
|
Whether the input is optional or not.
An optional input can accept |
False
|
name
|
string
|
Optional name string for the module. Should be unique in a program (do not reuse the same name twice). It will be autogenerated if it isn't provided. |
None
|
Returns:
Type | Description |
---|---|
SymbolicDataModel
|
The symbolic data model corresponding to the given data model/schema. |