Browse Source

Update 'README.md'

天问 2 years ago
parent
commit
ef7658e981
1 changed files with 19 additions and 0 deletions
  1. 19 0
      README.md

+ 19 - 0
README.md

@@ -37,5 +37,24 @@ baby_agi = BabyAGI.from_llm(
 ```
 
 
+```
+from langchain.agents import create_csv_agent
+from langchain.utilities import PythonREPL
+
+CG_TOKEN = input("Insert chatgpt token >>> ")
+os.environ["CHATGPT_TOKEN"] = CG_TOKEN
+start_chat = input("Do you want start a chat from existing chat? (y/n): ") # ask if you want start a chat from existing chat
+if start_chat == "y":
+    chat_id = input("Insert chat-id (chat.openai.com/c/(IS THIS ->)58XXXX0f-XXXX-XXXX-XXXX-faXXXXd2b50f)  ->") # ask the chat id
+    llm= ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"], conversation=chat_id)
+else:
+    # llm= ChatGPTAPI.ChatGPT(token=os.environ["CHATGPT_TOKEN"])
+    llm=HuggingChatAPI.HuggingChat() 
+agent = create_csv_agent(llm=llm, tool=PythonREPL(), path=path_csv, verbose=True)
+prompt = input("(Enter your task or question) >> ")
+while prompt != "exit":
+    agent.run(prompt)
+    prompt = input("(Enter your task or question) >> ")
 
+```