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

Add Flag to Add Struct Methods to JSON Schema #143

Open
h0rv opened this issue May 8, 2024 · 2 comments
Open

Add Flag to Add Struct Methods to JSON Schema #143

h0rv opened this issue May 8, 2024 · 2 comments

Comments

@h0rv
Copy link

h0rv commented May 8, 2024

I am looking for functionality similar to Pydantics .model_dump_json() where it generates the JSON schema of all fields and methods of a Python class.

This package does all of that, except for adding the struct methods to the schema.

I want this feature for LLM function calling, so an LLM can get an understanding of what methods it can call, and send back the function name and parameters to call the function.

I am looking to add this package as the standard for JSON schema generation from struct and validation for https://github.com/instructor-ai/instructor-go which is a port of https://github.com/jxnl/instructor.

Thanks!

@stillmatic
Copy link

there's prob a cleaner way to do so but this works: https://github.com/stillmatic/gollum/blob/main/functions.go#L29

@h0rv
Copy link
Author

h0rv commented May 12, 2024

@stillmatic thank you! I based my solution off of yours here: instructor-ai/instructor-go#9

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

No branches or pull requests

2 participants