constants.py 2.5 KB

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