Commit
·
61d35d5
1
Parent(s):
00c92c0
push demo
Browse files
llm.py
CHANGED
@@ -2,7 +2,9 @@ import os
|
|
2 |
|
3 |
from orq_ai_sdk import OrqAI
|
4 |
|
5 |
-
import
|
|
|
|
|
6 |
|
7 |
client = OrqAI(api_key=os.environ["ORQ_API_KEY"], environment="develop")
|
8 |
|
@@ -19,10 +21,10 @@ def stream_request(variant: str, secret: str, user_input: str):
|
|
19 |
context={"step": variant}, # , "environments": []},
|
20 |
inputs={"secret": secret, "user_input": user_input},
|
21 |
)
|
22 |
-
|
23 |
|
24 |
for chunk in stream:
|
25 |
-
|
26 |
if not chunk.is_final:
|
27 |
yield chunk.choices[0].message.content
|
28 |
|
@@ -52,7 +54,7 @@ def run_judge(level: int, inputs: dict):
|
|
52 |
context={"step": special_checks[level]},
|
53 |
inputs=inputs,
|
54 |
)
|
55 |
-
|
56 |
answer = generation.choices[0].message.content.split(" ")[-1]
|
57 |
return answer.lower() == "yes"
|
58 |
|
|
|
2 |
|
3 |
from orq_ai_sdk import OrqAI
|
4 |
|
5 |
+
import logging
|
6 |
+
|
7 |
+
LOGGER = logging.getLogger(__name__)
|
8 |
|
9 |
client = OrqAI(api_key=os.environ["ORQ_API_KEY"], environment="develop")
|
10 |
|
|
|
21 |
context={"step": variant}, # , "environments": []},
|
22 |
inputs={"secret": secret, "user_input": user_input},
|
23 |
)
|
24 |
+
LOGGER.info(stream)
|
25 |
|
26 |
for chunk in stream:
|
27 |
+
LOGGER.info(chunk)
|
28 |
if not chunk.is_final:
|
29 |
yield chunk.choices[0].message.content
|
30 |
|
|
|
54 |
context={"step": special_checks[level]},
|
55 |
inputs=inputs,
|
56 |
)
|
57 |
+
LOGGER.info(generation.choices[0].message.content)
|
58 |
answer = generation.choices[0].message.content.split(" ")[-1]
|
59 |
return answer.lower() == "yes"
|
60 |
|