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

Merge structured output from henry_dev_rebase branch via temp #16

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

LemmyTron
Copy link
Collaborator

Add structured output from henry_dev_rebase branch via temp_pr_branch, fix output typo

@LemmyTron LemmyTron changed the title Create branch for merges Merge structured output from henry_dev_rebase branch via temp Oct 28, 2024
Copy link
Collaborator

@chowington chowington left a comment

Choose a reason for hiding this comment

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

Looks good, overall! Just a couple of things to fix

Comment on lines 216 to 221
content = completion.choices[0].message.content
print("Response content:", content)
cost_logger.update_cost(
completion, input_cost=openai_config["model-costs"]["input"], output_cost=openai_config["model-costs"]["output"]
)
return content
Copy link
Collaborator

@chowington chowington Nov 8, 2024

Choose a reason for hiding this comment

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

Here you'll want to work with and return message.parsed like in the other low-level structured outputs function, the one that I made. Then you'll need to bubble that up through the higher-level functions so they work with an object rather than a string (looks like you already did this to a certain degree)

Comment on lines 1275 to 1276
class Decide_to_Talk(BaseModel):
decision: str
Copy link
Collaborator

@chowington chowington Nov 8, 2024

Choose a reason for hiding this comment

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

Since this response is just a "yes" or "no", a boolean might be more straightforward in this case. You'll want to update the prompting to reflect a boolean also

@@ -1361,8 +1361,7 @@ def get_fail_safe():
prompt = generate_prompt(prompt_input, prompt_template)

fail_safe = get_fail_safe()
output = safe_generate_response(prompt, gpt_param, 5, fail_safe,
__func_validate, __func_clean_up)
output = generate_structured_response(prompt,gpt_param,Decide_to_Talk,5,fail_safe,__func_validate,__func_clean_up)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you fix the formatting in this line? Thanks!

output = safe_generate_response(prompt, gpt_param, 5, fail_safe,
__func_validate, __func_clean_up)
output = ChatGPT_generate_structured_response(prompt, Convo_Takeaways,example_output, special_instruction, 3, fail_safe, __chat_func_validate, __chat_func_clean_up, True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you swap in generate_structured_response instead here?

@chowington chowington self-requested a review November 22, 2024 19:40
@chowington chowington merged commit 36df909 into dev Nov 22, 2024
@chowington chowington deleted the temp_pr_branch branch November 22, 2024 19:43
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.

2 participants