Skip to content

Commit 7635940

Browse files
Fixed ruff lint issues in nemo guardrails (buerokratt#387)
* remove unwanted file * updated changes * fixed requested changes * fixed issue * service workflow implementation without calling service endpoints * fixed requested changes * fixed issues * protocol related requested changes * fixed requested changes * update time tracking * added time tracking and reloacate input guardrail before toolclassifiier * fixed issue * fixed issue * added hybrid search for the service detection * update tool classifier * fixing merge conflicts * fixed issue * optimize first user query response generation time * fixed pr reviewed issues * service integration * context based response generation flow * fixed pr review suggested issues * removed service project layer * fixed issues * delete unnessary files * added requested changes * fixed ruff lint issues for nemo guardrails --------- Co-authored-by: Thiru Dinesh <56014038+Thirunayan22@users.noreply.github.com>
1 parent a8dea14 commit 7635940

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/guardrails/dspy_nemo_adapter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _identifying_params(self) -> Dict[str, Any]:
6262
"streaming": self.streaming,
6363
}
6464

65-
def _get_dspy_lm(self) -> Any:
65+
def _get_dspy_lm(self) -> dspy.LM:
6666
"""
6767
Get the active DSPy LM from settings.
6868
@@ -264,9 +264,9 @@ async def _astream(
264264
loop = asyncio.get_running_loop()
265265

266266
# Sentinel to mark end of stream
267-
SENTINEL = object()
267+
sentinel = object()
268268

269-
def producer():
269+
def producer() -> None:
270270
"""
271271
Synchronous producer running in a thread.
272272
Calls DSPy's LM with stream=True and pushes chunks to queue.
@@ -289,7 +289,7 @@ def producer():
289289
loop.call_soon_threadsafe(queue.put_nowait, chunk)
290290

291291
# Signal completion
292-
loop.call_soon_threadsafe(queue.put_nowait, SENTINEL)
292+
loop.call_soon_threadsafe(queue.put_nowait, sentinel)
293293

294294
except Exception as e:
295295
# Pass exception to async consumer
@@ -305,7 +305,7 @@ def producer():
305305
chunk = await queue.get()
306306

307307
# Check for completion
308-
if chunk is SENTINEL:
308+
if chunk is sentinel:
309309
break
310310

311311
# Check for errors from producer

src/guardrails/optimized_guardrails_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class OptimizedGuardrailsLoader:
1919
- Falls back to base config if optimization not found
2020
"""
2121

22-
def __init__(self, optimized_modules_dir: Optional[Path] = None):
22+
def __init__(self, optimized_modules_dir: Optional[Path] = None) -> None:
2323
"""
2424
Initialize the guardrails loader.
2525

0 commit comments

Comments
 (0)