-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
There was a problem hiding this 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
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 |
There was a problem hiding this comment.
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)
class Decide_to_Talk(BaseModel): | ||
decision: str |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
Add structured output from henry_dev_rebase branch via temp_pr_branch, fix output typo