amir22010 commited on
Commit
632facd
·
verified ·
1 Parent(s): e002a67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -96,7 +96,28 @@ async def greet(product,description):
96
  # {"role": "user", "content": guardrail_prompt.format(user_reques)},
97
  # ]
98
  #nemo guard
99
- config = RailsConfig.from_path("nemo")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  app = LLMRails(config=config, llm=client)
101
  options = {"output_vars": ["triggered_input_rail", "triggered_output_rail"]}
102
  output = app.generate(messages=messages, options=options)
 
96
  # {"role": "user", "content": guardrail_prompt.format(user_reques)},
97
  # ]
98
  #nemo guard
99
+ # config = RailsConfig.from_path("nemo")
100
+ YAML_CONFIG = """
101
+ models:
102
+ - type: main
103
+ engine: groq
104
+ model: llama-3.2-11b-text-preview
105
+
106
+ rails:
107
+ input:
108
+ flows:
109
+ - self check input
110
+ - check blocked terms
111
+
112
+ output:
113
+ flows:
114
+ - self check output
115
+ - check blocked terms
116
+ - self check facts
117
+
118
+ streaming: False
119
+ """
120
+ config = RailsConfig.from_content(yaml_content=YAML_CONFIG)
121
  app = LLMRails(config=config, llm=client)
122
  options = {"output_vars": ["triggered_input_rail", "triggered_output_rail"]}
123
  output = app.generate(messages=messages, options=options)