Skip to content

Commit

Permalink
feat: add streaming handler
Browse files Browse the repository at this point in the history
  • Loading branch information
billmetangmo committed Dec 26, 2023
1 parent 8325a9a commit a7a616d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions etl/experiments/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
SystemMessagePromptTemplate,
)
from langchain.vectorstores import FAISS

from langchain.callbacks.streaming_stdout_final_only import (
StreamingStdOutCallbackHandler,
)

sentry_sdk.init(
dsn="https://a38e91a66c70912c38406fef32d86809@o4504301629407232.ingest.sentry.io/4506436450844672",
Expand Down Expand Up @@ -48,7 +50,7 @@
vectors = FAISS.from_documents(data, embeddings)
vectors.save_local(embedding_pth)

llm = ChatOpenAI(max_tokens=500, temperature=0, model_name="gpt-3.5-turbo",streaming=True)
llm = ChatOpenAI(max_tokens=500, temperature=0, model_name="gpt-3.5-turbo",streaming=True,callbacks=[StreamingStdOutCallbackHandler()])
chain_type_kwargs = {"prompt": CHAT_PROMPT}


Expand Down

0 comments on commit a7a616d

Please sign in to comment.