Spaces:
Running
Running
remove comments
Browse files
agent.py
CHANGED
@@ -6,20 +6,10 @@ from typing import List, TypedDict
|
|
6 |
from langgraph.types import Command
|
7 |
from typing import Literal, List
|
8 |
from langgraph.graph import StateGraph, START, END
|
9 |
-
# import boto3
|
10 |
from dotenv import load_dotenv
|
11 |
|
12 |
load_dotenv()
|
13 |
|
14 |
-
# ssm = boto3.client(
|
15 |
-
# 'ssm',
|
16 |
-
# region_name="us-east-2",
|
17 |
-
# # aws_access_key_id=os.environ['AWS_ACCESS_KEY'],
|
18 |
-
# # aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY']
|
19 |
-
# )
|
20 |
-
|
21 |
-
# os.environ['TAVILY_API_KEY'] = ssm.get_parameter(Name="TAVILY_API_KEY", WithDecryption=True)['Parameter']['Value']
|
22 |
-
|
23 |
def get_platform_tips(state) -> Command[Literal['web_search']]:
|
24 |
"""Conduct a web search to find up-to-date information on how to write an effective post for the provided platform."""
|
25 |
tavily_tool=TavilySearchResults(max_results=5)
|
@@ -153,7 +143,7 @@ def fetch_image(state) -> Command[Literal[END]]:
|
|
153 |
}
|
154 |
|
155 |
headers = {
|
156 |
-
"Authorization": os.getenv("PEXELS_API_KEY")
|
157 |
}
|
158 |
|
159 |
response = requests.get(url, headers=headers, params=params)
|
@@ -182,8 +172,7 @@ model = ChatGoogleGenerativeAI(
|
|
182 |
temperature=0,
|
183 |
max_tokens=None,
|
184 |
timeout=None,
|
185 |
-
max_retries=2,
|
186 |
-
# google_api_key=ssm.get_parameter(Name="GOOGLE_API_KEY", WithDecryption=True)['Parameter']['Value']
|
187 |
)
|
188 |
|
189 |
workflow = StateGraph(State)
|
|
|
6 |
from langgraph.types import Command
|
7 |
from typing import Literal, List
|
8 |
from langgraph.graph import StateGraph, START, END
|
|
|
9 |
from dotenv import load_dotenv
|
10 |
|
11 |
load_dotenv()
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def get_platform_tips(state) -> Command[Literal['web_search']]:
|
14 |
"""Conduct a web search to find up-to-date information on how to write an effective post for the provided platform."""
|
15 |
tavily_tool=TavilySearchResults(max_results=5)
|
|
|
143 |
}
|
144 |
|
145 |
headers = {
|
146 |
+
"Authorization": os.getenv("PEXELS_API_KEY")
|
147 |
}
|
148 |
|
149 |
response = requests.get(url, headers=headers, params=params)
|
|
|
172 |
temperature=0,
|
173 |
max_tokens=None,
|
174 |
timeout=None,
|
175 |
+
max_retries=2,
|
|
|
176 |
)
|
177 |
|
178 |
workflow = StateGraph(State)
|