change max lenght
This commit is contained in:
@@ -67,7 +67,9 @@ def get_adaptor(platform: str, config: dict = None) -> SkillAdaptor:
|
||||
if platform not in ADAPTORS:
|
||||
available = ", ".join(ADAPTORS.keys())
|
||||
if not ADAPTORS:
|
||||
raise ValueError(f"No adaptors are currently implemented. Platform '{platform}' is not available.")
|
||||
raise ValueError(
|
||||
f"No adaptors are currently implemented. Platform '{platform}' is not available."
|
||||
)
|
||||
raise ValueError(
|
||||
f"Platform '{platform}' is not supported or not yet implemented. Available platforms: {available}"
|
||||
)
|
||||
|
||||
@@ -167,14 +167,28 @@ version: {metadata.version}
|
||||
# Validate ZIP file
|
||||
package_path = Path(package_path)
|
||||
if not package_path.exists():
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"File not found: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"File not found: {package_path}",
|
||||
}
|
||||
|
||||
if not package_path.suffix == ".zip":
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Not a ZIP file: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Not a ZIP file: {package_path}",
|
||||
}
|
||||
|
||||
# Prepare API request
|
||||
api_url = self.DEFAULT_API_ENDPOINT
|
||||
headers = {"x-api-key": api_key, "anthropic-version": "2023-06-01", "anthropic-beta": "skills-2025-10-02"}
|
||||
headers = {
|
||||
"x-api-key": api_key,
|
||||
"anthropic-version": "2023-06-01",
|
||||
"anthropic-beta": "skills-2025-10-02",
|
||||
}
|
||||
|
||||
timeout = kwargs.get("timeout", 60)
|
||||
|
||||
@@ -231,7 +245,12 @@ version: {metadata.version}
|
||||
except:
|
||||
error_msg = f"HTTP {response.status_code}"
|
||||
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Upload failed: {error_msg}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Upload failed: {error_msg}",
|
||||
}
|
||||
|
||||
except requests.exceptions.Timeout:
|
||||
return {
|
||||
@@ -250,7 +269,12 @@ version: {metadata.version}
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Unexpected error: {str(e)}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Unexpected error: {str(e)}",
|
||||
}
|
||||
|
||||
def validate_api_key(self, api_key: str) -> bool:
|
||||
"""
|
||||
@@ -363,7 +387,9 @@ version: {metadata.version}
|
||||
print(f"❌ Error calling Claude API: {e}")
|
||||
return False
|
||||
|
||||
def _read_reference_files(self, references_dir: Path, max_chars: int = 200000) -> dict[str, str]:
|
||||
def _read_reference_files(
|
||||
self, references_dir: Path, max_chars: int = 200000
|
||||
) -> dict[str, str]:
|
||||
"""
|
||||
Read reference markdown files from skill directory.
|
||||
|
||||
|
||||
@@ -169,10 +169,20 @@ See the references directory for complete documentation with examples and best p
|
||||
# Validate package file FIRST
|
||||
package_path = Path(package_path)
|
||||
if not package_path.exists():
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"File not found: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"File not found: {package_path}",
|
||||
}
|
||||
|
||||
if not package_path.suffix == ".gz":
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Not a tar.gz file: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Not a tar.gz file: {package_path}",
|
||||
}
|
||||
|
||||
# Check for google-generativeai library
|
||||
try:
|
||||
@@ -210,7 +220,9 @@ See the references directory for complete documentation with examples and best p
|
||||
}
|
||||
|
||||
# Upload to Files API
|
||||
uploaded_file = genai.upload_file(path=str(main_file), display_name=f"{package_path.stem}_instructions")
|
||||
uploaded_file = genai.upload_file(
|
||||
path=str(main_file), display_name=f"{package_path.stem}_instructions"
|
||||
)
|
||||
|
||||
# Upload reference files (if any)
|
||||
refs_dir = temp_path / "references"
|
||||
@@ -230,7 +242,12 @@ See the references directory for complete documentation with examples and best p
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Upload failed: {str(e)}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Upload failed: {str(e)}",
|
||||
}
|
||||
|
||||
def validate_api_key(self, api_key: str) -> bool:
|
||||
"""
|
||||
@@ -337,7 +354,9 @@ See the references directory for complete documentation with examples and best p
|
||||
print(f"❌ Error calling Gemini API: {e}")
|
||||
return False
|
||||
|
||||
def _read_reference_files(self, references_dir: Path, max_chars: int = 200000) -> dict[str, str]:
|
||||
def _read_reference_files(
|
||||
self, references_dir: Path, max_chars: int = 200000
|
||||
) -> dict[str, str]:
|
||||
"""
|
||||
Read reference markdown files from skill directory.
|
||||
|
||||
|
||||
@@ -185,10 +185,20 @@ Always prioritize accuracy by consulting the attached documentation files before
|
||||
# Validate package file FIRST
|
||||
package_path = Path(package_path)
|
||||
if not package_path.exists():
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"File not found: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"File not found: {package_path}",
|
||||
}
|
||||
|
||||
if not package_path.suffix == ".zip":
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Not a ZIP file: {package_path}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Not a ZIP file: {package_path}",
|
||||
}
|
||||
|
||||
# Check for openai library
|
||||
try:
|
||||
@@ -254,7 +264,9 @@ Always prioritize accuracy by consulting the attached documentation files before
|
||||
|
||||
# Attach files to vector store
|
||||
if file_ids:
|
||||
client.beta.vector_stores.files.create_batch(vector_store_id=vector_store.id, file_ids=file_ids)
|
||||
client.beta.vector_stores.files.create_batch(
|
||||
vector_store_id=vector_store.id, file_ids=file_ids
|
||||
)
|
||||
|
||||
# Create assistant
|
||||
assistant = client.beta.assistants.create(
|
||||
@@ -273,7 +285,12 @@ Always prioritize accuracy by consulting the attached documentation files before
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
return {"success": False, "skill_id": None, "url": None, "message": f"Upload failed: {str(e)}"}
|
||||
return {
|
||||
"success": False,
|
||||
"skill_id": None,
|
||||
"url": None,
|
||||
"message": f"Upload failed: {str(e)}",
|
||||
}
|
||||
|
||||
def validate_api_key(self, api_key: str) -> bool:
|
||||
"""
|
||||
@@ -389,7 +406,9 @@ Always prioritize accuracy by consulting the attached documentation files before
|
||||
print(f"❌ Error calling OpenAI API: {e}")
|
||||
return False
|
||||
|
||||
def _read_reference_files(self, references_dir: Path, max_chars: int = 200000) -> dict[str, str]:
|
||||
def _read_reference_files(
|
||||
self, references_dir: Path, max_chars: int = 200000
|
||||
) -> dict[str, str]:
|
||||
"""
|
||||
Read reference markdown files from skill directory.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user