Spaces:
Running
Running
File size: 1,908 Bytes
b4ea9c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
#!/usr/bin/env python3
import sys
import pkg_resources
print("π Version Information:")
print(f"Python: {sys.version}")
print()
packages_to_check = [
'gradio', 'gradio-client', 'pydantic', 'pydantic-core',
'langchain', 'langchain-core', 'langgraph', 'typing-extensions',
'fastapi', 'starlette', 'uvicorn'
]
for package in packages_to_check:
try:
version = pkg_resources.get_distribution(package).version
print(f"{package}: {version}")
except pkg_resources.DistributionNotFound:
print(f"{package}: NOT INSTALLED")
except Exception as e:
print(f"{package}: ERROR - {e}")
print()
print("π Critical Type Checking:")
try:
from typing_extensions import TypedDict
print("β
TypedDict import successful")
except Exception as e:
print(f"β TypedDict import failed: {e}")
try:
from pydantic import BaseModel, Field
print("β
Pydantic imports successful")
# Test schema generation
class TestModel(BaseModel):
name: str = Field(description="Test field")
schema = TestModel.model_json_schema()
print(f"β
Pydantic schema generation successful: {type(schema)}")
# Check for boolean values in schema
def check_schema_values(obj, path=""):
if isinstance(obj, dict):
for k, v in obj.items():
if isinstance(v, bool):
print(f"π Found boolean in schema at {path}.{k}: {v}")
elif isinstance(v, (dict, list)):
check_schema_values(v, f"{path}.{k}")
elif isinstance(obj, list):
for i, item in enumerate(obj):
if isinstance(item, (dict, list)):
check_schema_values(item, f"{path}[{i}]")
check_schema_values(schema)
except Exception as e:
print(f"β Pydantic test failed: {e}")
import traceback
traceback.print_exc() |