tool_bundle.py 912 B

123456789101112131415161718192021222324252627282930313233343536
  1. from typing import Any, Optional
  2. from pydantic import BaseModel
  3. from core.tools.entities.tool_entities import ToolParameter, ToolProviderType
  4. class ApiBasedToolBundle(BaseModel):
  5. """
  6. This class is used to store the schema information of an api based tool. such as the url, the method, the parameters, etc.
  7. """
  8. # server_url
  9. server_url: str
  10. # method
  11. method: str
  12. # summary
  13. summary: Optional[str] = None
  14. # operation_id
  15. operation_id: str = None
  16. # parameters
  17. parameters: Optional[list[ToolParameter]] = None
  18. # author
  19. author: str
  20. # icon
  21. icon: Optional[str] = None
  22. # openapi operation
  23. openapi: dict
  24. class AppToolBundle(BaseModel):
  25. """
  26. This class is used to store the schema information of an tool for an app.
  27. """
  28. type: ToolProviderType
  29. credential: Optional[dict[str, Any]] = None
  30. provider_id: str
  31. tool_name: str