Compare commits

...

2 Commits

Author SHA1 Message Date
Evan Lohn
34875a91cd fix for basemodel issue 2025-02-04 13:10:06 -08:00
Evan Lohn
1e16761c85 code for timing old main basic search 2025-02-04 13:06:33 -08:00
2 changed files with 14 additions and 0 deletions

View File

@@ -415,6 +415,9 @@ def handle_new_chat_message(
)
def stream_generator() -> Generator[str, None, None]:
import time
start_time = time.time()
try:
for packet in stream_chat_message(
new_msg_req=chat_message_req,
@@ -427,6 +430,14 @@ def handle_new_chat_message(
),
is_connected=is_connected_func,
):
if "top_documents" in packet:
to_first_docs = time.time() - start_time
print(f"Time to first docs: {to_first_docs}")
print(packet)
elif "answer_piece" in packet:
to_answer_piece = time.time() - start_time
print(f"Time to answer piece: {to_answer_piece}")
print(packet)
yield json.dumps(packet) if isinstance(packet, dict) else packet
except Exception as e:

View File

@@ -25,6 +25,9 @@ class ToolCallSummary(BaseModel__v1):
tool_call_request: AIMessage
tool_call_result: ToolMessage
class Config:
arbitrary_types_allowed = True
def tool_call_tokens(
tool_call_summary: ToolCallSummary, llm_tokenizer: BaseTokenizer