tool_bundle.py 923 B

1234567891011121314151617181920212223242526272829303132333435
  1. from typing import Any, Dict, List, Optional
  2. from core.tools.entities.tool_entities import ToolParameter, ToolProviderType
  3. from pydantic import BaseModel
  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