| Type |
|
|---|---|
| Multiplicity | 0..1 |
How code attribute is used is subclass-specific:
- Crew - code is added to the top of the generated crew class after configuration fields and before any other declarations.
- Agent and Task - code is used as agent/task method body template.
- Function - code is used to produce function body.
- Tool - what is added to the tools array. E.g.
SerperDevTool().
Code can contain interpolation tokens for adding imports. Example:
my_var = ${spel:addItemImport('my_module', 'my_item').item}
spel:is a prefix for Spring Expression Language tokens.addItemImport('my_module', 'my_item').item- callsorg.nasdanika.models.python.Source.addImport()method and thengetItem()value of the result. Import methods:addItemImport(module, item)- the method used aboveaddItemImport(module, item, name)- in this case use.nameaddModuleImport(module)- in this case use add dot and imported item after the token. e.g.${spel:addModuleImport('my_module').module}.my_itemaddModuleImport(module, alias)- in this case use add dot and imported item after the token. e.g.${spel:addModuleImport('my_module', 'mi_modulo').alias}.my_item
Nasdanika Models