Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
拿辰 committed Oct 26, 2023
1 parent ac539cd commit 0cc09f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modelscope_agent/llm/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def generate(self, prompt):
response = ''.join(completions)

# truncate response
response = response.split("<|user|>")[0]
response = response.split('<|user|>')[0]
idx = response.find('<|endofthink|>')
if idx != -1:
response = response[:idx + len('<|endofthink|>')]
Expand Down
5 changes: 3 additions & 2 deletions modelscope_agent/output_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import re
import traceback
from typing import Dict, Tuple

import json
import traceback


class OutputParser:

Expand Down Expand Up @@ -75,4 +76,4 @@ def parse_response(self, response: str) -> Tuple[str, Dict]:

return action, parameters
except Exception:
raise ValueError('Wrong response format for output parser')
raise ValueError('Wrong response format for output parser')
2 changes: 1 addition & 1 deletion modelscope_agent/tools/text_to_image_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ def _parse_output(self, origin_result, remote=True):
cv2.COLOR_BGR2RGB)
else:
# image = origin_result['output_img']
image = origin_result.output['results'][0]["url"]
image = origin_result.output['results'][0]['url']

return {'result': ImageWrapper(image)}

0 comments on commit 0cc09f4

Please sign in to comment.