akryldigital commited on
Commit
f877a27
·
verified ·
1 Parent(s): a9daa85

remove callbacks

Browse files
Files changed (1) hide show
  1. src/llm/adapters.py +4 -5
src/llm/adapters.py CHANGED
@@ -11,8 +11,8 @@ from langchain_openai.chat_models import ChatOpenAI
11
  # Legacy dependencies
12
  from huggingface_hub import InferenceClient
13
  from langchain_community.llms import HuggingFaceEndpoint
14
- from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
15
  from langchain_community.chat_models.huggingface import ChatHuggingFace
 
16
 
17
 
18
  from ..config.loader import load_config
@@ -71,7 +71,7 @@ def _create_dedicated_endpoint_client():
71
  max_tokens = dedicated_config.get("max_tokens", 768)
72
 
73
  # Set up the streaming callback handler
74
- callback = StreamingStdOutCallbackHandler()
75
 
76
  # Initialize the HuggingFaceEndpoint with streaming enabled
77
  llm_qa = HuggingFaceEndpoint(
@@ -80,11 +80,10 @@ def _create_dedicated_endpoint_client():
80
  repetition_penalty=1.03,
81
  timeout=70,
82
  huggingfacehub_api_token=api_key,
83
- streaming=True,
84
- callbacks=[callback]
85
  )
86
 
87
- # Create a ChatHuggingFace instance with the streaming-enabled endpoint
88
  return ChatHuggingFace(llm=llm_qa)
89
 
90
 
 
11
  # Legacy dependencies
12
  from huggingface_hub import InferenceClient
13
  from langchain_community.llms import HuggingFaceEndpoint
 
14
  from langchain_community.chat_models.huggingface import ChatHuggingFace
15
+ # from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
16
 
17
 
18
  from ..config.loader import load_config
 
71
  max_tokens = dedicated_config.get("max_tokens", 768)
72
 
73
  # Set up the streaming callback handler
74
+ # callback = StreamingStdOutCallbackHandler()
75
 
76
  # Initialize the HuggingFaceEndpoint with streaming enabled
77
  llm_qa = HuggingFaceEndpoint(
 
80
  repetition_penalty=1.03,
81
  timeout=70,
82
  huggingfacehub_api_token=api_key,
83
+ streaming=True
84
+ # callbacks=[callback]
85
  )
86
 
 
87
  return ChatHuggingFace(llm=llm_qa)
88
 
89