Spaces:
Sleeping
Sleeping
Kate Forsberg
commited on
Commit
·
a6c9658
1
Parent(s):
cdf9374
updated to dev
Browse files- app.py +21 -33
- poetry.lock +0 -0
- pyproject.toml +1 -1
app.py
CHANGED
@@ -28,6 +28,7 @@ load_dotenv()
|
|
28 |
|
29 |
Defaults.drivers_config = AnthropicDriversConfig()
|
30 |
|
|
|
31 |
base_url = "https://cloud.griptape.ai"
|
32 |
|
33 |
headers_api = {
|
@@ -81,17 +82,8 @@ def bot(history):
|
|
81 |
def create_prompt_task(session_id: str, message: str) -> PromptTask:
|
82 |
return PromptTask(
|
83 |
f"""
|
84 |
-
Re-structure the values from the user's questions: '{message}' and the input value from the conversation memory
|
85 |
-
|
86 |
-
location: <x>
|
87 |
-
role: <x>
|
88 |
-
skills: <x>
|
89 |
-
expected salary: <x>
|
90 |
-
availability: <x>
|
91 |
-
past companies: <x>
|
92 |
-
past projects: <x>
|
93 |
-
show reel details: <x>
|
94 |
-
""",
|
95 |
)
|
96 |
|
97 |
|
@@ -106,29 +98,29 @@ def build_talk_agent(session_id: str, message: str) -> Agent:
|
|
106 |
value="You are responsible for structuring a user's questions into a specific format for a query."
|
107 |
),
|
108 |
Rule(
|
109 |
-
value="You ask the user follow-up questions to fill in missing information for
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
),
|
114 |
Rule(
|
115 |
-
value="
|
116 |
),
|
117 |
],
|
118 |
)
|
119 |
-
file_manager_tool = FileManagerTool(
|
120 |
-
name="FileManager",
|
121 |
-
file_manager_driver=LocalFileManagerDriver(),
|
122 |
-
off_prompt=False,
|
123 |
-
)
|
124 |
-
|
125 |
return Agent(
|
126 |
conversation_memory=ConversationMemory(
|
127 |
-
|
128 |
-
thread_id=
|
129 |
)
|
130 |
),
|
131 |
-
tools=[file_manager_tool],
|
132 |
tasks=[create_prompt_task(session_id, message)],
|
133 |
rulesets=[ruleset],
|
134 |
)
|
@@ -144,7 +136,7 @@ def build_agent(session_id: str, message: str) -> Agent:
|
|
144 |
name="Local Gradio Agent",
|
145 |
rules=[
|
146 |
Rule(
|
147 |
-
value="You are responsible for structuring a user's questions into a
|
148 |
),
|
149 |
Rule(
|
150 |
value="Only return the result of the query, do not provide additional commentary."
|
@@ -154,7 +146,7 @@ def build_agent(session_id: str, message: str) -> Agent:
|
|
154 |
value="Do not perform the query unless the user has said 'Done' with formulating."
|
155 |
),
|
156 |
Rule(
|
157 |
-
value="Only perform the query
|
158 |
),
|
159 |
Rule(
|
160 |
value="If you reformulate the query, then you must ask the user if they are 'Done' again."
|
@@ -165,16 +157,13 @@ def build_agent(session_id: str, message: str) -> Agent:
|
|
165 |
],
|
166 |
)
|
167 |
|
168 |
-
print("Base URL", os.environ.get("BASE_URL", "https://cloud.griptape.ai"))
|
169 |
-
|
170 |
query_client = StructureRunTool(
|
171 |
name="QueryResumeSearcher",
|
172 |
description="Use it to search for a candidate with the query.",
|
173 |
driver=GriptapeCloudStructureRunDriver(
|
174 |
-
# base_url=os.environ.get("BASE_URL","https://cloud.griptape.ai"),
|
175 |
structure_id=os.getenv("GT_STRUCTURE_ID"),
|
176 |
api_key=os.getenv("GT_CLOUD_API_KEY"),
|
177 |
-
structure_run_wait_time_interval=
|
178 |
structure_run_max_wait_time_attempts=30,
|
179 |
),
|
180 |
)
|
@@ -186,10 +175,9 @@ def build_agent(session_id: str, message: str) -> Agent:
|
|
186 |
structure_factory_fn=lambda: build_talk_agent(session_id, message),
|
187 |
),
|
188 |
)
|
189 |
-
|
190 |
return Agent(
|
191 |
conversation_memory=ConversationMemory(
|
192 |
-
|
193 |
thread_id=threads[session_id],
|
194 |
)
|
195 |
),
|
|
|
28 |
|
29 |
Defaults.drivers_config = AnthropicDriversConfig()
|
30 |
|
31 |
+
|
32 |
base_url = "https://cloud.griptape.ai"
|
33 |
|
34 |
headers_api = {
|
|
|
82 |
def create_prompt_task(session_id: str, message: str) -> PromptTask:
|
83 |
return PromptTask(
|
84 |
f"""
|
85 |
+
Re-structure the values to form a query from the user's questions: '{message}' and the input value from the conversation memory. Leave out attributes that aren't important to the user:
|
86 |
+
""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
)
|
88 |
|
89 |
|
|
|
98 |
value="You are responsible for structuring a user's questions into a specific format for a query."
|
99 |
),
|
100 |
Rule(
|
101 |
+
value="""You ask the user follow-up questions to fill in missing information for:
|
102 |
+
years experience,
|
103 |
+
location,
|
104 |
+
role,
|
105 |
+
skills,
|
106 |
+
expected salary,
|
107 |
+
availability,
|
108 |
+
past companies,
|
109 |
+
past projects,
|
110 |
+
show reel details
|
111 |
+
"""
|
112 |
),
|
113 |
Rule(
|
114 |
+
value="Return the current query structure and any questions to fill in missing information."
|
115 |
),
|
116 |
],
|
117 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
return Agent(
|
119 |
conversation_memory=ConversationMemory(
|
120 |
+
conversation_memory_driver=GriptapeCloudConversationMemoryDriver(
|
121 |
+
thread_id=threads[session_id],
|
122 |
)
|
123 |
),
|
|
|
124 |
tasks=[create_prompt_task(session_id, message)],
|
125 |
rulesets=[ruleset],
|
126 |
)
|
|
|
136 |
name="Local Gradio Agent",
|
137 |
rules=[
|
138 |
Rule(
|
139 |
+
value="You are responsible for structuring a user's questions into a query and then querying."
|
140 |
),
|
141 |
Rule(
|
142 |
value="Only return the result of the query, do not provide additional commentary."
|
|
|
146 |
value="Do not perform the query unless the user has said 'Done' with formulating."
|
147 |
),
|
148 |
Rule(
|
149 |
+
value="Only perform the query as one string argument."
|
150 |
),
|
151 |
Rule(
|
152 |
value="If you reformulate the query, then you must ask the user if they are 'Done' again."
|
|
|
157 |
],
|
158 |
)
|
159 |
|
|
|
|
|
160 |
query_client = StructureRunTool(
|
161 |
name="QueryResumeSearcher",
|
162 |
description="Use it to search for a candidate with the query.",
|
163 |
driver=GriptapeCloudStructureRunDriver(
|
|
|
164 |
structure_id=os.getenv("GT_STRUCTURE_ID"),
|
165 |
api_key=os.getenv("GT_CLOUD_API_KEY"),
|
166 |
+
structure_run_wait_time_interval=3,
|
167 |
structure_run_max_wait_time_attempts=30,
|
168 |
),
|
169 |
)
|
|
|
175 |
structure_factory_fn=lambda: build_talk_agent(session_id, message),
|
176 |
),
|
177 |
)
|
|
|
178 |
return Agent(
|
179 |
conversation_memory=ConversationMemory(
|
180 |
+
conversation_memory_driver=GriptapeCloudConversationMemoryDriver(
|
181 |
thread_id=threads[session_id],
|
182 |
)
|
183 |
),
|
poetry.lock
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
CHANGED
@@ -12,7 +12,7 @@ package-mode = false
|
|
12 |
python = "^3.11"
|
13 |
python-dotenv = "^1.0.0"
|
14 |
gradio = "^4.37.1"
|
15 |
-
griptape = {
|
16 |
argparse = "^1.4.0"
|
17 |
azure-identity = "^1.17.1"
|
18 |
|
|
|
12 |
python = "^3.11"
|
13 |
python-dotenv = "^1.0.0"
|
14 |
gradio = "^4.37.1"
|
15 |
+
griptape = {git="https://github.com/griptape-ai/griptape.git", rev = "dev", extras=["drivers-embedding-voyageai","drivers-prompt-anthropic"]}
|
16 |
argparse = "^1.4.0"
|
17 |
azure-identity = "^1.17.1"
|
18 |
|