Skip to content

Adam/epd 2068 update python sdk for self hosted deployments (#360) - #362

Closed
josorio-autoblocks wants to merge 1 commit into
mainfrom
jose/epd-2072-update-sdks-to-support-default-value-and-add-safe-parse
Closed

Adam/epd 2068 update python sdk for self hosted deployments (#360)#362
josorio-autoblocks wants to merge 1 commit into
mainfrom
jose/epd-2072-update-sdks-to-support-default-value-and-add-safe-parse

Conversation

@josorio-autoblocks

@josorio-autoblocks josorio-autoblocks commented Jun 25, 2025

Copy link
Copy Markdown
Contributor
  • Update env variable

  • Update env variable

  • Update auto tracer

Greptile Summary

Updates the Python SDK to support self-hosted deployments by making the V2 API endpoint configurable and adds default value support for schema properties.

  • Modified autoblocks/_impl/config/constants.py to make V2 API endpoint configurable via AUTOBLOCKS_V2_API_ENDPOINT environment variable
  • Added default_value field to autoblocks/_impl/datasets/models/schema.py BaseSchemaProperty class for specifying default values
  • Updated autoblocks/_impl/tracer/auto_tracer.py to use configurable API endpoint for trace collection
  • Added field validators in autoblocks/_impl/datasets/models/dataset.py to handle schema property validation more gracefully
  • Added new test file tests/autoblocks/test_app_client_datasets.py for testing schema property deserialization with default values

* Update env variable

* Update env variable

* Update auto tracer

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile


API_ENDPOINT = "https://api.autoblocks.ai"
API_ENDPOINT_V2 = "https://api-v2.autoblocks.ai"
API_ENDPOINT_V2 = AutoblocksEnvVar.V2_API_ENDPOINT_V2.get() or "https://api-v2.autoblocks.ai"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Consider what happens if get() returns an empty string - would still fallback to default URL as intended?

Comment on lines +39 to +61
@field_validator("schema_properties", mode="before")
@classmethod
def validate_schema_properties(cls, v: Optional[List[Dict[str, Any]]]) -> Optional[List[SchemaProperty]]:
"""Validate and convert schema properties using factory function"""
if v is None:
return None

if not isinstance(v, list):
return v

result = []
for item in v:
if isinstance(item, dict):
try:
result.append(create_schema_property(item))
except (ValueError, TypeError):
# If we can't parse a specific property, skip it rather than failing entirely
# This provides better resilience against API changes
continue
else:
result.append(item)

return result

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Duplicate validation logic between Dataset and DatasetSchema classes. Consider extracting to a shared validator function to maintain DRY principles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants