Skip to content

fix: Corrected vertex AI's JSON schema#197

Merged
chandrasekharan-zipstack merged 2 commits intomainfrom
fix/vertex-ai-json-schema-corrected
Sep 2, 2025
Merged

fix: Corrected vertex AI's JSON schema#197
chandrasekharan-zipstack merged 2 commits intomainfrom
fix/vertex-ai-json-schema-corrected

Conversation

@chandrasekharan-zipstack
Copy link
Contributor

What

  • Fixed Vertex AI's JSON schema
  • Minor error handling fix for a file storage function

Why

  • Faulty JSON schema led to error
image - Decorator led to catching and rethrowing the same exception

Notes on Testing

  • Tested it locally
  • Noticed error handling behaviour while debugging other issues

Screenshots

...

Checklist

I have read and understood the Contribution Guidelines.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Corrected Vertex AI safety settings schema to remove an invalid property, improving configuration validation.
  • Refactor
    • Improved reliability of file existence checks by adjusting caching behavior.
  • Style
    • Cleaned up logging message formatting in file storage helper (no functional changes).
  • Chores
    • Bumped SDK version to v0.77.1.

Summary by CodeRabbit

  • Bug Fixes
    • Updated Vertex AI safety settings schema to remove an extraneous type property.
    • Adjusted file existence checks to no longer bypass local cache.
  • Style
    • Cleaned up log message formatting in file storage components for clearer error reporting.

Walkthrough

Removed the type property from Vertex AI safety_settings schema; simplified two error log f-strings; removed the @skip_local_cache decorator from FileStorage.exists (method signature/body unchanged).

Changes

Cohort / File(s) Summary of Changes
Vertex AI LLM JSON schema
src/unstract/sdk/adapters/llm/vertex_ai/src/static/json_schema.json
Removed type property from safety_settings.properties; other safety properties and defaults unchanged.
File storage: logging formatting
src/unstract/sdk/file_storage/helper.py
Replaced multi-part f-string concatenations with single-line f-strings in error log messages; no behavioral changes.
File storage: exists caching behavior
src/unstract/sdk/file_storage/impl.py
Deleted the @skip_local_cache decorator from FileStorage.exists; method implementation and signature remain the same.
Version bump
src/unstract/sdk/__init__.py
Updated __version__ from v0.77.0 to v0.77.1.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Caller
  participant FS as FileStorage.exists
  participant LC as LocalCache
  participant P as Provider FS

  rect rgba(230,240,255,0.5)
  note over FS: New flow (after removing @skip_local_cache)
  C->>FS: exists(path)
  FS->>LC: check cached existence
  alt cache hit
    LC-->>FS: cached result
    FS-->>C: result
  else cache miss
    FS->>P: exists(path)
    P-->>FS: result
    FS->>LC: update cache
    FS-->>C: result
  end
  end
Loading
sequenceDiagram
  autonumber
  participant C as Caller
  participant FS as FileStorage.exists
  participant P as Provider FS

  rect rgba(255,240,230,0.5)
  note over FS: Previous flow (with @skip_local_cache)
  C->>FS: exists(path)
  FS->>P: exists(path) 	// cache bypassed
  P-->>FS: result
  FS-->>C: result
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between f79c57e and d2443aa.

📒 Files selected for processing (1)
  • src/unstract/sdk/__init__.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/unstract/sdk/init.py
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/vertex-ai-json-schema-corrected

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/unstract/sdk/file_storage/helper.py (1)

81-87: Wrapper drops return value on FileNotFoundError retry

If the first call raises FileNotFoundError, the retry result isn’t returned, causing callers to receive None.

     def wrapper(*args, **kwargs):
         try:
             return func(*args, **kwargs)
         except FileNotFoundError:
-            _handle_file_not_found(func, *args, **kwargs)
+            return _handle_file_not_found(func, *args, **kwargs)
         except Exception as e:
             raise FileOperationError(str(e)) from e
🧹 Nitpick comments (1)
src/unstract/sdk/file_storage/helper.py (1)

48-49: Prefer exc_info for full trace in error logs

Use structured logging with exc_info to capture the stack trace instead of interpolating the exception into the message.

-            logger.error(f"Error in initialising {provider.value} file system {e}")
+            logger.error("Error in initialising %s file system", provider.value, exc_info=True)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between e298a41 and f79c57e.

📒 Files selected for processing (3)
  • src/unstract/sdk/adapters/llm/vertex_ai/src/static/json_schema.json (0 hunks)
  • src/unstract/sdk/file_storage/helper.py (2 hunks)
  • src/unstract/sdk/file_storage/impl.py (0 hunks)
💤 Files with no reviewable changes (2)
  • src/unstract/sdk/file_storage/impl.py
  • src/unstract/sdk/adapters/llm/vertex_ai/src/static/json_schema.json

@pk-zipstack
Copy link
Contributor

@chandrasekharan-zipstack Do we know what might have caused this issue with vertex AI adapter? Was wondering if this was caused by any dependency update since we did not face this issue earlier.

@chandrasekharan-zipstack
Copy link
Contributor Author

@chandrasekharan-zipstack Do we know what might have caused this issue with vertex AI adapter? Was wondering if this was caused by any dependency update since we did not face this issue earlier.

We fixed the frontend validation for the JSON schema form which led to this coming up

@chandrasekharan-zipstack chandrasekharan-zipstack merged commit 4afc1f2 into main Sep 2, 2025
2 checks passed
@chandrasekharan-zipstack chandrasekharan-zipstack deleted the fix/vertex-ai-json-schema-corrected branch September 2, 2025 06:53
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.

3 participants