datacipen commited on
Commit
40dcc90
1 Parent(s): 5013cb7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +15 -11
main.py CHANGED
@@ -7,6 +7,7 @@ from typing import List
7
  from pathlib import Path
8
  from langchain_huggingface import HuggingFaceEndpoint
9
  from langchain.schema import StrOutputParser
 
10
 
11
  from langchain.agents import AgentExecutor
12
  from langchain.agents.agent_types import AgentType
@@ -26,6 +27,11 @@ async def LLMistral():
26
  repo_id=repo_id, max_new_tokens=5300, temperature=0.1, task="text2text-generation", streaming=True
27
  )
28
  return llm
 
 
 
 
 
29
 
30
  @cl.set_chat_profiles
31
  async def chat_profile():
@@ -49,18 +55,16 @@ async def on_message(message: cl.Message):
49
  df = pd.read_csv(
50
  "./public/ExpeCFA_LP_CAA.csv"
51
  )
52
- model = await LLMistral()
53
 
54
- agent = create_pandas_dataframe_agent(model, df, verbose=True, allow_dangerous_code=True, handle_parsing_errors=True)
55
-
56
- #agent = create_csv_agent(
57
- # model,
58
- # "./public/ExpeCFA_LP_CAA.csv",
59
- # verbose=False,
60
- # allow_dangerous_code=True,
61
- # handle_parsing_errors=True,
62
- # agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
63
- #)
64
 
65
  msg = cl.Message(content="")
66
 
 
7
  from pathlib import Path
8
  from langchain_huggingface import HuggingFaceEndpoint
9
  from langchain.schema import StrOutputParser
10
+ from langchain_anthropic import AnthropicLLM
11
 
12
  from langchain.agents import AgentExecutor
13
  from langchain.agents.agent_types import AgentType
 
27
  repo_id=repo_id, max_new_tokens=5300, temperature=0.1, task="text2text-generation", streaming=True
28
  )
29
  return llm
30
+
31
+ async def LLM():
32
+ os.environ['ANTHROPIC_API_KEY'] = os.environ['ANTHROPIC_API_KEY']
33
+ llm = AnthropicLLM(model='claude-2.1')
34
+ return llm
35
 
36
  @cl.set_chat_profiles
37
  async def chat_profile():
 
55
  df = pd.read_csv(
56
  "./public/ExpeCFA_LP_CAA.csv"
57
  )
58
+ model = await LLM()
59
 
60
+ agent = create_csv_agent(
61
+ model,
62
+ "./public/ExpeCFA_LP_CAA.csv",
63
+ verbose=False,
64
+ allow_dangerous_code=True,
65
+ handle_parsing_errors=True,
66
+ agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
67
+ )
 
 
68
 
69
  msg = cl.Message(content="")
70