Identify the URL responsible for a specific action
(self, state: AgentState)
| 36 | self.dag_manager: DAGManager = DAGManager() |
| 37 | |
| 38 | def end_url_identify_agent(self, state: AgentState) -> AgentState: |
| 39 | """ |
| 40 | Identify the URL responsible for a specific action |
| 41 | """ |
| 42 | function_def = { |
| 43 | "name": "identify_end_url", |
| 44 | "description": "Identify the URL responsible for a specific action", |
| 45 | "parameters": { |
| 46 | "type": "object", |
| 47 | "properties": { |
| 48 | "url": { |
| 49 | "type": "string", |
| 50 | "description": f"The URL responsible for {self.prompt}" |
| 51 | } |
| 52 | }, |
| 53 | "required": ["url"] |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | prompt = f""" |
| 58 | {self.har_urls} |
| 59 | Task: |
| 60 | Given the above list of URLs, request types, and response formats, find the URL responsible for the action below: |
| 61 | {self.prompt} |
| 62 | """ |
| 63 | |
| 64 | response = llm.get_instance().invoke( |
| 65 | prompt, |
| 66 | functions=[function_def], |
| 67 | function_call={"name": "identify_end_url"} |
| 68 | ) |
| 69 | |
| 70 | function_call = response.additional_kwargs['function_call'] |
| 71 | end_url = json.loads(function_call['arguments'])['url'] |
| 72 | |
| 73 | state[self.ACTION_URL_KEY] = end_url |
| 74 | return state |
| 75 | |
| 76 | def input_variables_identifying_agent(self, state: AgentState) -> AgentState: |
| 77 | """ |