|
16 | 16 | from guardrails_api.clients.postgres_client import postgres_is_enabled
|
17 | 17 | from guardrails_api.utils.handle_error import handle_error
|
18 | 18 | from guardrails_api.utils.get_llm_callable import get_llm_callable
|
19 |
| -from guardrails_api.utils.prep_environment import cleanup_environment, prep_environment |
20 | 19 |
|
21 | 20 |
|
22 | 21 | guards_bp = Blueprint("guards", __name__, url_prefix="/guards")
|
|
27 | 26 | guard_client = PGGuardClient()
|
28 | 27 | else:
|
29 | 28 | guard_client = MemoryGuardClient()
|
30 |
| - # TODO: Accept file path as env var and dynamically import |
31 |
| - # read in guards from file |
32 |
| - import config |
| 29 | + # Will be defined at runtime |
| 30 | + import config # noqa |
33 | 31 |
|
34 | 32 | exports = config.__dir__()
|
35 | 33 | for export_name in exports:
|
@@ -180,9 +178,6 @@ def validate(guard_name: str):
|
180 | 178 | )
|
181 | 179 | decoded_guard_name = unquote_plus(guard_name)
|
182 | 180 | guard_struct = guard_client.get_guard(decoded_guard_name)
|
183 |
| - if isinstance(guard_struct, GuardStruct): |
184 |
| - # TODO: is there a way to do this with Guard? |
185 |
| - prep_environment(guard_struct) |
186 | 181 |
|
187 | 182 | llm_output = payload.pop("llmOutput", None)
|
188 | 183 | num_reasks = payload.pop("numReasks", guard_struct.num_reasks)
|
@@ -327,6 +322,4 @@ def validate_streamer(guard_iter):
|
327 | 322 | # prompt_params=prompt_params,
|
328 | 323 | # result=result
|
329 | 324 | # )
|
330 |
| - if isinstance(guard_struct, GuardStruct): |
331 |
| - cleanup_environment(guard_struct) |
332 | 325 | return validation_output.to_response()
|
0 commit comments