MCPcopy
hub / github.com/TencentQQGYLab/AppAgent / QwenModel

Class QwenModel

scripts/model.py:73–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73class QwenModel(BaseModel):
74 def __init__(self, api_key: str, model: str):
75 super().__init__()
76 self.model = model
77 dashscope.api_key = api_key
78
79 def get_model_response(self, prompt: str, images: List[str]) -> (bool, str):
80 content = [{
81 "text": prompt
82 }]
83 for img in images:
84 img_path = f"file://{img}"
85 content.append({
86 "image": img_path
87 })
88 messages = [
89 {
90 "role": "user",
91 "content": content
92 }
93 ]
94 response = dashscope.MultiModalConversation.call(model=self.model, messages=messages)
95 if response.status_code == HTTPStatus.OK:
96 return True, response.output.choices[0].message.content[0]["text"]
97 else:
98 return False, response.message
99
100
101def parse_explore_rsp(rsp):

Callers 3

task_executor.pyFile · 0.90
self_explorer.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected