mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
Create client for Tools API (#1348)
This commit creates a class for the new Tools API. It extracts common methods from crewai.cli.deploy.api.CrewAPI to a parent class.
This commit is contained in:
0
src/crewai/cli/tools/__init__.py
Normal file
0
src/crewai/cli/tools/__init__.py
Normal file
26
src/crewai/cli/tools/api.py
Normal file
26
src/crewai/cli/tools/api.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from typing import Optional
|
||||
from crewai.cli.plus_api import PlusAPI
|
||||
|
||||
|
||||
class ToolsAPI(PlusAPI):
|
||||
RESOURCE = "/crewai_plus/api/v1/tools"
|
||||
|
||||
def get(self, handle: str):
|
||||
return self._make_request("GET", f"{self.RESOURCE}/{handle}")
|
||||
|
||||
def publish(
|
||||
self,
|
||||
handle: str,
|
||||
public: bool,
|
||||
version: str,
|
||||
description: Optional[str],
|
||||
encoded_file: str,
|
||||
):
|
||||
params = {
|
||||
"handle": handle,
|
||||
"public": public,
|
||||
"version": version,
|
||||
"file": encoded_file,
|
||||
"description": description,
|
||||
}
|
||||
return self._make_request("POST", f"{self.RESOURCE}", json=params)
|
||||
Reference in New Issue
Block a user