constants.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. from __future__ import annotations
  2. import sys
  3. from pathlib import Path
  4. from huggingface_hub import ChatCompletionInputTool
  5. FILENAME_CONFIG = "agent.json"
  6. PROMPT_FILENAMES = ("PROMPT.md", "AGENTS.md")
  7. DEFAULT_AGENT = {
  8. "model": "Qwen/Qwen2.5-72B-Instruct",
  9. "provider": "nebius",
  10. "servers": [
  11. {
  12. "type": "stdio",
  13. "command": "npx",
  14. "args": [
  15. "-y",
  16. "@modelcontextprotocol/server-filesystem",
  17. str(Path.home() / ("Desktop" if sys.platform == "darwin" else "")),
  18. ],
  19. },
  20. {
  21. "type": "stdio",
  22. "command": "npx",
  23. "args": ["@playwright/mcp@latest"],
  24. },
  25. ],
  26. }
  27. DEFAULT_SYSTEM_PROMPT = """
  28. You are an agent - please keep going until the user’s query is completely
  29. resolved, before ending your turn and yielding back to the user. Only terminate
  30. your turn when you are sure that the problem is solved, or if you need more
  31. info from the user to solve the problem.
  32. If you are not sure about anything pertaining to the user’s request, use your
  33. tools to read files and gather the relevant information: do NOT guess or make
  34. up an answer.
  35. You MUST plan extensively before each function call, and reflect extensively
  36. on the outcomes of the previous function calls. DO NOT do this entire process
  37. by making function calls only, as this can impair your ability to solve the
  38. problem and think insightfully.
  39. """.strip()
  40. MAX_NUM_TURNS = 10
  41. TASK_COMPLETE_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore
  42. {
  43. "type": "function",
  44. "function": {
  45. "name": "task_complete",
  46. "description": "Call this tool when the task given by the user is complete",
  47. "parameters": {
  48. "type": "object",
  49. "properties": {},
  50. },
  51. },
  52. }
  53. )
  54. ASK_QUESTION_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore
  55. {
  56. "type": "function",
  57. "function": {
  58. "name": "ask_question",
  59. "description": "Ask the user for more info required to solve or clarify their problem.",
  60. "parameters": {
  61. "type": "object",
  62. "properties": {},
  63. },
  64. },
  65. }
  66. )
  67. EXIT_LOOP_TOOLS: list[ChatCompletionInputTool] = [TASK_COMPLETE_TOOL, ASK_QUESTION_TOOL]
  68. DEFAULT_REPO_ID = "tiny-agents/tiny-agents"