Skip to content

Conversation

@MnivL
Copy link

@MnivL MnivL commented May 18, 2025

Summary

This PR introduces multiple improvements and additions to enhance code maintainability and functionality:

  1. Gitignore Update: Added .idea/ directory to exclude IDE-specific files
  2. API Standardization: Unified environment variables to OpenAI API format
  3. Documentation: Added freshguide.md with:
    • Parameter configuration guidelines
    • Supported OpenAI API model provider interfaces
    • API documentation standards
  4. Tooling Improvements:
    • Added tools() method to ANPTool (replacing get_available_tools)
    • Improved code readability and maintainability
  5. JSON Parsing Utility:
    • Added anp_examples/utils/json_utils.py
    • Implemented robust_json_parse() function for handling function call arguments

Changes Breakdown

Core Improvements

  • Git hygiene: Added .idea/ to .gitignore
  • Environment standardization: Aligned env vars with OpenAI API spec
  • Added comprehensive freshguide.md documentation

Code Enhancements

  • Refactored tool discovery in ANPTool:
    • New tools() method (deprecates get_available_tools)
    • Improved method naming and code organization
  • Added robust JSON parsing utility:
    • Handles edge cases in function call arguments
    • Properly escapes special characters
    • Supports nested JSON structures
    • Includes type safety checks

New Utility Features

The json string used to handle the arguments returned by the function call.

def robust_json_parse(raw_args: str) -> Any:
    """Handles:
    - Standard JSON
    - Quote-wrapped strings
    - Missing braces/quotes
    - Partial JSON fragments
    - Type-safe fallback
    """

1. Add .idea/ to .gitignore
2. Standardize env variables to OpenAI format
3. Add freshguide.md documentation
4. Refactor ANPTool with tools() method
5. Implement robust JSON parser utility"
@yagi2018 yagi2018 added the enhancement New feature or request label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants