Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add more types to the type_map from python -> json schema #2095

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Nov 22, 2024

Without this, the following tool can't get added (list doesn't work, neither does List[str]):

def analyze_campaign(campaign_name: str, metrics: list, time_range: str) -> str:
    """
    Evaluate campaign performance metrics.

    Args:
        campaign_name (str): Name of the campaign.
        metrics (list): List of performance metrics to evaluate.
        time_range (str): Time range for analysis (e.g., 'last_week').

    Returns:
        str: Campaign performance summary.
    """
    import random
    performance_data = {
        "meeting_requests": random.randint(5, 20),
        "meetings_booked": random.randint(10, 30),
        "pipeline_generated": f"${random.randint(100000, 500000):,}",
        "closed_won": f"${random.randint(50000, 300000):,}"
    }
    performance_summary = ", ".join([f"{metric}: {performance_data.get(metric, 'N/A')}" for metric in metrics])
    return f"Campaign: {campaign_name} | {performance_summary} in {time_range}."

None: "null",
type(None): "null",
# Optional types
Optional[str]: "string",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mattzh72 maybe it makes sense to kill this?
Optional[str]: "string",

because of the code above? if is_optional(py_type):

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm yeah agreed - seems like above catches all the Optionals and unwraps them.

@cpacker cpacker merged commit 708feec into main Nov 22, 2024
14 of 15 checks passed
@cpacker cpacker deleted the fix-tool-schema-generator-with-more-options branch November 22, 2024 20:12
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