Skip to content

Commit

Permalink
Adds nluconfig concept
Browse files Browse the repository at this point in the history
  • Loading branch information
malamasn committed Jan 13, 2025
1 parent ea6125a commit 3ac9c66
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dflow/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class TransformationDataModel(BaseModel):
roles: List[str] = []
policies: Dict[str, set] = {}
ac_misc: AccessControlMisc = AccessControlMisc()
nlu_config: Dict[str, str] = {}

class Config:
arbitrary_types_allowed = True
Expand Down Expand Up @@ -140,7 +141,8 @@ def generate(metamodel,
connectors=data.connectors,
roles=data.roles,
policies=data.policies,
ac_misc=data.ac_misc
ac_misc=data.ac_misc,
nlu_config=data.nlu_config
)
)
chmod(out_file, 509)
Expand Down Expand Up @@ -207,6 +209,10 @@ def parse_model(model, out_dir) -> TransformationDataModel:

data = add_static_scenario(data)

# Extract nlu_config
if model.nlu_config:
data.nlu_config = {'name': model.nlu_config.name, 'weights': model.nlu_config.weights}

# Extract synonyms
synonyms_dictionary = {}
for synonym in model.synonyms:
Expand Down
5 changes: 5 additions & 0 deletions dflow/grammar/dflow.tx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import utils
import connector
import auth
import nluconfig

dFlow:
(
Expand Down Expand Up @@ -57,6 +58,10 @@ dFlow:
('connectors'
connectors*=Connector
'end')?

('nluconfig'
nlu_config=NLUConfig
'end')?
)#
;

Expand Down
7 changes: 7 additions & 0 deletions dflow/grammar/nluconfig.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NLUConfig:
(
('model_name:' name=STRING)
('model_weights:' weights=STRING)
)#
;

0 comments on commit 3ac9c66

Please sign in to comment.