Zipstack / unstract

No-code LLM Platform to launch APIs and ETL Pipelines to structure unstructured documents
https://unstract.com
GNU Affero General Public License v3.0
883 stars 54 forks source link

[FEAT] Tool Export Validation #299

Closed harini-venkataraman closed 3 months ago

harini-venkataraman commented 3 months ago

What

This PR enables support for exporting only valid tools that have prompts and that are executed. ...

Why

This prevents export of dummy tools developed using Prompt Studio. ...

How

Adding validations to see if the Output Manager has a valid field against the prompt. ...

Can this PR break any existing features. If yes please list of possible items. If no please explain why. (PS: Admins do not merge the PR without this section filled)

  1. Export validation is an additional filtering check and does not break features.
  2. Export functional logic has these changes made, but will prevent export only if there is not valid prompt.

...

Database Migrations

Not applicable.

...

Env Config

Not applicable. ...

Notes on Testing

  1. Test by exporting a properly executed tool.
  2. Create a prompt with no text prompt entered, try exporting.
  3. Create a prompt and without executing it, try exporting.

...

Screenshots

Screenshot from 2024-04-29 16-13-53 GT

Screenshot from 2024-04-29 15-59-04

image

Checklist

I have read and understood the [Contribution Guidelines]().

harini-venkataraman commented 3 months ago

Note that failing fast is also an option in case of a project with lot of prompts - we needn't wait for a while and throw the error. We'd unnecessarily build this JSON or make DB queries even after an invalid prompt is noted

@chandrasekharan-zipstack Yes, this makes sense. But in cases where one or more invalid prompts is stored in a single project, error surfacing each time export is clicked might not be a good user experience. One thing we can do is continue the iteration if any invalid prompt is encountered. This way DB communications will be avoided. Let me validate this and see if this works.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud