Skip to content

Commit

Permalink
Feat/remove remote logic for openapi test (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhangpurdue authored Nov 4, 2024
1 parent e89c720 commit ad883dc
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions modelscope_agent/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,27 +679,27 @@ def call(self, params: str, **kwargs):
url = url.replace(f'{{{name}}}', f'{value}')
try:
# visit tool node to call tool
if self.is_remote:
response = requests.post(
f'{self.openapi_service_manager_url}/execute_openapi',
json={
'url': url,
'params': query_params,
'headers': header,
'method': method,
'cookies': cookies,
'data': data
},
headers=headers)
logger.query_info(
message=f'calling tool message {response.json()}')

response.raise_for_status()
else:
credentials = kwargs.get('credentials', {})
header = self._parse_credentials(credentials, header)
response = execute_api_call(url, method, header, query_params,
data, cookies)
# if self.is_remote:
# response = requests.post(
# f'{self.openapi_service_manager_url}/execute_openapi',
# json={
# 'url': url,
# 'params': query_params,
# 'headers': header,
# 'method': method,
# 'cookies': cookies,
# 'data': data
# },
# headers=headers)
# logger.query_info(
# message=f'calling tool message {response.json()}')
#
# response.raise_for_status()
# else:
credentials = kwargs.get('credentials', {})
header = self._parse_credentials(credentials, header)
response = execute_api_call(url, method, header, query_params,
data, cookies)
return OpenapiServiceProxy.parse_service_response(response)
except Exception as e:
raise RuntimeError(
Expand Down

0 comments on commit ad883dc

Please sign in to comment.