SyedHasanCronosPMC commited on
Commit
d49f1a2
·
verified ·
1 Parent(s): aa0bd73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -3,7 +3,6 @@ import os
3
  import matplotlib.pyplot as plt
4
  import pandas as pd
5
  from langgraph.graph import StateGraph
6
- from langgraph_core.state import MessagesState
7
  from langchain_core.messages import HumanMessage, AIMessage
8
  from langchain_anthropic import ChatAnthropic
9
  import warnings
@@ -21,17 +20,11 @@ api_key = os.getenv("ANTHROPIC_API_KEY")
21
  if not api_key:
22
  raise ValueError("ANTHROPIC_API_KEY environment variable not set")
23
 
24
- # Load Claude 3.5 Sonnet model
25
- # Using a direct approach to avoid proxies issue
26
- try:
27
- # Explicitly create with minimal parameters
28
- llm = ChatAnthropic(api_key=api_key, model="claude-3-5-sonnet-20240229")
29
- except Exception as e:
30
- print(f"Error initializing ChatAnthropic: {e}")
31
- # Fallback initialization if needed
32
- import anthropic
33
- client = anthropic.Anthropic(api_key=api_key)
34
- llm = ChatAnthropic(client=client, model="claude-3-5-sonnet-20240229")
35
 
36
  # System prompt constructor
37
  def make_system_prompt(suffix: str) -> str:
 
3
  import matplotlib.pyplot as plt
4
  import pandas as pd
5
  from langgraph.graph import StateGraph
 
6
  from langchain_core.messages import HumanMessage, AIMessage
7
  from langchain_anthropic import ChatAnthropic
8
  import warnings
 
20
  if not api_key:
21
  raise ValueError("ANTHROPIC_API_KEY environment variable not set")
22
 
23
+ # Load Claude 3.5 Sonnet model with explicit minimal parameters to avoid 'proxies' issue
24
+ llm = ChatAnthropic(
25
+ api_key=api_key,
26
+ model="claude-3-5-sonnet-20240229"
27
+ )
 
 
 
 
 
 
28
 
29
  # System prompt constructor
30
  def make_system_prompt(suffix: str) -> str: