Niki Zhang commited on
Commit
963ca45
·
verified ·
1 Parent(s): bc11d2a

Update chatbox.py

Browse files
Files changed (1) hide show
  1. chatbox.py +3 -2
chatbox.py CHANGED
@@ -13,7 +13,7 @@ import inspect
13
  from langchain.agents.initialize import initialize_agent
14
  from langchain.agents.tools import Tool
15
  from langchain.chains.conversation.memory import ConversationBufferMemory
16
- from langchain.llms.openai import OpenAIChat
17
  import torch
18
  from PIL import Image, ImageDraw, ImageOps
19
  from transformers import pipeline, BlipProcessor, BlipForConditionalGeneration, BlipForQuestionAnswering
@@ -140,7 +140,8 @@ def build_chatbot_tools(load_dict):
140
  class ConversationBot:
141
  def __init__(self, tools, api_key=""):
142
  # load_dict = {'VisualQuestionAnswering':'cuda:0', 'ImageCaptioning':'cuda:1',...}
143
- llm = OpenAIChat(model_name="gpt-4o", temperature=0.7, openai_api_key=api_key, model_kwargs={"api_version": "2020-11-07"})
 
144
  self.llm = llm
145
  self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
146
  self.tools = tools
 
13
  from langchain.agents.initialize import initialize_agent
14
  from langchain.agents.tools import Tool
15
  from langchain.chains.conversation.memory import ConversationBufferMemory
16
+ from langchain_community.chat_models import ChatOpenAI
17
  import torch
18
  from PIL import Image, ImageDraw, ImageOps
19
  from transformers import pipeline, BlipProcessor, BlipForConditionalGeneration, BlipForQuestionAnswering
 
140
  class ConversationBot:
141
  def __init__(self, tools, api_key=""):
142
  # load_dict = {'VisualQuestionAnswering':'cuda:0', 'ImageCaptioning':'cuda:1',...}
143
+ print("chatbot api",api_key)
144
+ llm = ChatOpenAI(model_name="gpt-4o", temperature=0.7, openai_api_key=api_key, model_kwargs={"api_version": "2020-11-07"})
145
  self.llm = llm
146
  self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
147
  self.tools = tools