Commit
·
00a4e8f
1
Parent(s):
7213cdc
Minor fix
Browse files- graphs/dataflow.yml +0 -1
- operators/chatgpt_op.py +4 -1
- operators/file_saver_op.py +1 -1
graphs/dataflow.yml
CHANGED
|
@@ -118,7 +118,6 @@ nodes:
|
|
| 118 |
- id: mistral
|
| 119 |
operator:
|
| 120 |
python: ../operators/mistral_op.py
|
| 121 |
-
# python: ../operators/chatgpt_op.py
|
| 122 |
inputs:
|
| 123 |
raw_file: vectordb/raw_file
|
| 124 |
outputs:
|
|
|
|
| 118 |
- id: mistral
|
| 119 |
operator:
|
| 120 |
python: ../operators/mistral_op.py
|
|
|
|
| 121 |
inputs:
|
| 122 |
raw_file: vectordb/raw_file
|
| 123 |
outputs:
|
operators/chatgpt_op.py
CHANGED
|
@@ -56,6 +56,7 @@ def save_as(content, path):
|
|
| 56 |
import pyarrow as pa
|
| 57 |
|
| 58 |
from dora import DoraStatus
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
class Operator:
|
|
@@ -72,11 +73,13 @@ class Operator:
|
|
| 72 |
input = dora_event["value"][0].as_py()
|
| 73 |
with open(input["path"], "r", encoding="utf8") as f:
|
| 74 |
raw = f.read()
|
|
|
|
| 75 |
print("--- Asking chatGPT ", flush=True)
|
| 76 |
prompt, response = ask_gpt(input["query"], raw)
|
| 77 |
blocks = extract_command(response)
|
| 78 |
print(response, flush=True)
|
| 79 |
-
print(
|
|
|
|
| 80 |
send_output(
|
| 81 |
"output_file",
|
| 82 |
pa.array(
|
|
|
|
| 56 |
import pyarrow as pa
|
| 57 |
|
| 58 |
from dora import DoraStatus
|
| 59 |
+
import time
|
| 60 |
|
| 61 |
|
| 62 |
class Operator:
|
|
|
|
| 73 |
input = dora_event["value"][0].as_py()
|
| 74 |
with open(input["path"], "r", encoding="utf8") as f:
|
| 75 |
raw = f.read()
|
| 76 |
+
ask_time = time.time()
|
| 77 |
print("--- Asking chatGPT ", flush=True)
|
| 78 |
prompt, response = ask_gpt(input["query"], raw)
|
| 79 |
blocks = extract_command(response)
|
| 80 |
print(response, flush=True)
|
| 81 |
+
print("Response time:", time.time() - ask_time, flush=True)
|
| 82 |
+
|
| 83 |
send_output(
|
| 84 |
"output_file",
|
| 85 |
pa.array(
|
operators/file_saver_op.py
CHANGED
|
@@ -18,7 +18,7 @@ class Operator:
|
|
| 18 |
dora_event,
|
| 19 |
send_output,
|
| 20 |
) -> DoraStatus:
|
| 21 |
-
if dora_event["type"] == "INPUT" and dora_event["id"] == "
|
| 22 |
input = dora_event["value"][0].as_py()
|
| 23 |
|
| 24 |
with open(input["path"], "r") as file:
|
|
|
|
| 18 |
dora_event,
|
| 19 |
send_output,
|
| 20 |
) -> DoraStatus:
|
| 21 |
+
if dora_event["type"] == "INPUT" and dora_event["id"] == "chatgpt_output_file":
|
| 22 |
input = dora_event["value"][0].as_py()
|
| 23 |
|
| 24 |
with open(input["path"], "r") as file:
|