Skip to content

Created reply_in_json_interface and add json_interface_string utility #107

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Durbatuluk1701
Copy link

Not sure if you are wanting/accepting PRs, but I've found this reply_in_json_interface prompting utility to work well.

I noticed that reply_in_json was not yielding great results for my testing (notably on smaller models), as the model would occasionally ignore required interface fields or not respond with valid json.

This instead gives a more concrete, typescript style interface that the models seem to follow more consistently.

Example

class Address(BaseModel):
    street: str = Field(description="Street name and number")
    city: str
    zip_code: str

x = Address(....)
reply_in_json_interface(x)

yields:

Reply with the following JSON interface:
```
{
    street : string; // Street name and number
    city : string;
    zip_code : string;
}
```

… (modify agent example to use reply_in_json_interface)
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.

1 participant