Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Improve yaml gen prompting #22

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

Conversation

bparees
Copy link
Collaborator

@bparees bparees commented Nov 10, 2023

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization
  • Documentation Update

Description

Attempts to ensure we get back an unformatted(no markdown) response from the
model and only get a single resource type (previously was getting back a
not just a deployment but also a service and a PVC, when asking for a mongodb
deployment)

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

@bparees bparees marked this pull request as ready for review November 10, 2023 21:17
@@ -56,18 +66,19 @@ def generate_yaml(self, conversation, string, **kwargs):
response = llm_chain(inputs={"string": string})

# https://stackoverflow.com/a/63082323/2328066
regex = r"(?:\n+|\A)?(?P<code_block>\`{3,}yaml\n+[\S\s]*\`{3,})"

Choose a reason for hiding this comment

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

Assuming that we don't need any extra parsing on response. Looks good to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is another case of "eventually we will" (at a minimum we should be yaml linting the response to confirm it is indeed a valid yaml response and has no formatting around it) but for now this change gets the api endpoint working again w/ the current model

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants