Skip to content

Commit

Permalink
+ if check before content.split()
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyjohnson1 committed Aug 13, 2024
1 parent 9a19c36 commit b3f6ef6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion topos/api/websocket_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ async def chat(websocket: WebSocket):
tokens_per_second = total_tokens / elapsed_time
ttl_num_toks = 0
for i in simp_msg_history:
ttl_num_toks += len(i['content'].split())
if isinstance(i['content'], str):
ttl_num_toks += len(i['content'].split())
await process_logger.end("llm_generation_stream_chat", toks_per_sec=f"{tokens_per_second:.1f}", ttfs=f"{ttfs}", num_toks=num_user_toks, ttl_num_toks=ttl_num_toks)
# Fetch semantic category from the output
# semantic_compression = SemanticCompression(model=f"ollama:{model}", api_key=get_openai_api_key())
Expand Down

0 comments on commit b3f6ef6

Please sign in to comment.