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

[Feature]: Add an extract_json() custom function to the allowed functions in tasks #981

Open
1 task done
HamadaSalhab opened this issue Dec 20, 2024 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@HamadaSalhab
Copy link
Contributor

HamadaSalhab commented Dec 20, 2024

🔖 Feature description

Example:

Consider the following output from a prompt step for example:

I have analyzed the data, and here are my findings:

```json
{
  "foo": "bar",
  "joe": "biden"
}```

Let me know if you have any other questions:

Having a utility extract_json() would make it easier for the users to extract the json content by doing something like this:

- evaluate:
    analysis: extract_json(_)

Instead the current way, which is:

- evaluate:
    analysis: load_json(_[_.find("```json")+7:][:_[_.find("```json")+7:].find("```")])

And now analysis would be a dictionary that contains "foo" and "joe" as keys, "bar" and "biden" as values respectively.

🎤 Why is this feature needed ?

No response

✌️ How do you aim to achieve this?

No response

👀 Have you searched issues and PRs to see if this feature request has been raised before?

  • I checked and didn't find similar issue
@HamadaSalhab HamadaSalhab added the enhancement New feature or request label Dec 20, 2024
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

No branches or pull requests

1 participant