Spaces:
Sleeping
Sleeping
fix: error
Browse files- services/model_handler.py +40 -39
services/model_handler.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import logging
|
|
|
|
| 2 |
from agno.models.openai import OpenAILike
|
| 3 |
from agno.tools.arxiv import ArxivTools
|
| 4 |
from agno.tools.pubmed import PubmedTools
|
|
@@ -33,9 +34,9 @@ class ModelHandler:
|
|
| 33 |
api_key=str(random.choice(API_KEYS)),
|
| 34 |
base_url="https://api.moonshot.cn/v1",
|
| 35 |
id="moonshot-v1-8k",
|
| 36 |
-
instructions=
|
| 37 |
-
|
| 38 |
-
|
| 39 |
)
|
| 40 |
)
|
| 41 |
|
|
@@ -46,16 +47,16 @@ class ModelHandler:
|
|
| 46 |
api_key=str(random.choice(API_KEYS)),
|
| 47 |
base_url="https://api.moonshot.cn/v1",
|
| 48 |
id="moonshot-v1-8k",
|
| 49 |
-
instructions=
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
show_tool_calls=True
|
| 60 |
),
|
| 61 |
tools=[ArxivTools(), PubmedTools()]
|
|
@@ -67,20 +68,20 @@ class ModelHandler:
|
|
| 67 |
api_key=str(random.choice(API_KEYS)),
|
| 68 |
base_url="https://api.moonshot.cn/v1",
|
| 69 |
id="moonshot-v1-8k",
|
| 70 |
-
instructions=
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
)
|
| 85 |
)
|
| 86 |
|
|
@@ -91,18 +92,18 @@ class ModelHandler:
|
|
| 91 |
api_key=str(random.choice(API_KEYS)),
|
| 92 |
base_url="https://api.moonshot.cn/v1",
|
| 93 |
id="moonshot-v1-8k",
|
| 94 |
-
instructions=
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
)
|
| 106 |
)
|
| 107 |
|
| 108 |
|
|
|
|
| 1 |
import logging
|
| 2 |
+
from textwrap import dedent
|
| 3 |
from agno.models.openai import OpenAILike
|
| 4 |
from agno.tools.arxiv import ArxivTools
|
| 5 |
from agno.tools.pubmed import PubmedTools
|
|
|
|
| 34 |
api_key=str(random.choice(API_KEYS)),
|
| 35 |
base_url="https://api.moonshot.cn/v1",
|
| 36 |
id="moonshot-v1-8k",
|
| 37 |
+
instructions=dedent("""\
|
| 38 |
+
Translate the query to English
|
| 39 |
+
""")
|
| 40 |
)
|
| 41 |
)
|
| 42 |
|
|
|
|
| 47 |
api_key=str(random.choice(API_KEYS)),
|
| 48 |
base_url="https://api.moonshot.cn/v1",
|
| 49 |
id="moonshot-v1-8k",
|
| 50 |
+
instructions=dedent("""\
|
| 51 |
+
- You have ArxivTools and PubmedTools at your disposal. Use them to find relevant papers for the question.
|
| 52 |
+
- You need to understand the context of the question to provide the best answer based on your tools.
|
| 53 |
+
- Be precise and provide just enough information to be useful.
|
| 54 |
+
- You must cite the sources used in your answer.
|
| 55 |
+
- You must create an accessible summary.
|
| 56 |
+
- The content must be for people without autism knowledge.
|
| 57 |
+
- Focus in the main findings of the paper taking in consideration the question.
|
| 58 |
+
- The answer must be brief.
|
| 59 |
+
"""),
|
| 60 |
show_tool_calls=True
|
| 61 |
),
|
| 62 |
tools=[ArxivTools(), PubmedTools()]
|
|
|
|
| 68 |
api_key=str(random.choice(API_KEYS)),
|
| 69 |
base_url="https://api.moonshot.cn/v1",
|
| 70 |
id="moonshot-v1-8k",
|
| 71 |
+
instructions=dedent("""\
|
| 72 |
+
- You must provide just enough information to be useful
|
| 73 |
+
- You must cite the sources used in your answer.
|
| 74 |
+
- You must be clear and concise.
|
| 75 |
+
- You must create an accessible summary.
|
| 76 |
+
- The content must be for people without autism knowledge.
|
| 77 |
+
- Focus in the main findings of the paper taking in consideration the question.
|
| 78 |
+
- The answer must be brief.
|
| 79 |
+
- Remove everything related to the run itself like: 'Running: transfer_' just use plain text
|
| 80 |
+
- You must use the language provided by the user to present the results.
|
| 81 |
+
- Add references to the sources used in the answer.
|
| 82 |
+
- Add emojis to make the presentation more interactive.
|
| 83 |
+
- Translate the answer to Portuguese.
|
| 84 |
+
"""),
|
| 85 |
)
|
| 86 |
)
|
| 87 |
|
|
|
|
| 92 |
api_key=str(random.choice(API_KEYS)),
|
| 93 |
base_url="https://api.moonshot.cn/v1",
|
| 94 |
id="moonshot-v1-8k",
|
| 95 |
+
instructions=dedent("""\
|
| 96 |
+
- You are multilingual
|
| 97 |
+
- You must present the results in a clear and concise manner.
|
| 98 |
+
- Clean up the presentation to make it more readable.
|
| 99 |
+
- Remove unnecessary information.
|
| 100 |
+
- Remove everything related to the run itself like: 'Running: transfer_', just use plain text
|
| 101 |
+
- You must use the language provided by the user to present the results.
|
| 102 |
+
- Add references to the sources used in the answer.
|
| 103 |
+
- Add emojis to make the presentation more interactive.
|
| 104 |
+
- Translate the answer to Portuguese.
|
| 105 |
+
"""),
|
| 106 |
+
)
|
| 107 |
)
|
| 108 |
|
| 109 |
|