-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Python: Update chat_gpt_api.py #5445
Conversation
there are some errors in chat.add_user_message/assistant_message. You cannot just make chat as a object of ChatHistory, instead make it as chat_history = ChatHistory(system_message=system_message) also define service_id and pass it into kernel.add_service: such as : service_id = "chat-gpt" kernel.add_service( sk_oai.OpenAIChatCompletion( service_id="chat-gpt", ai_model_id="gpt-3.5-turbo", api_key=api_key) )
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.
thanks for doing this, some minor comments!
@microsoft-github-policy-service agree company="Xflow" |
.. |
@Sarfaraz021 Lint is failing due to: samples/kernel-syntax-examples/chat_gpt_api.py:8:5: F401 [*] |
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.
one small thing, really close!
@moonbox3 it's been used here according to the new commit suggested by @eavanvalkenburg -> settings = kernel.get_prompt_execution_settings_from_service_id("chat-gpt", ChatCompletionClientBase) |
changing in service_id variable
I understand. If Lint says it's failing, then we need to look at why. There's no subjectivity involved. :) |
what could be the solution of this now? should I remove import st: of ChatCompletionClientBase and use previous technique |
Now that you have the arguments in the correct order, it should be fine. You should try running |
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, thanks for picking up my small nits!
or use the |
sure am gonna do that and will get back asap:) |
working fine now. |
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, thanks!
@Sarfaraz021 still got a lint error for the black check... |
@eavanvalkenburg let me check |
Hi @eavanvalkenburg am done, please start testing again. |
@Sarfaraz021 I am not seeing any new commit. Did you push the Lint fix upstream? |
|
When you run the VSCode task or black formatting manually (via |
hi @moonbox3 am done with push changes on main branch |
Hi @moonbox3 @eavanvalkenburg any updates |
we can't do anything until all the checks pass, and the black check still doesn't, I would pull the latest, redo |
@Sarfaraz021 simply doing a merge from main to your PR branch isn't going to fix the lint issue. You need to make sure you pull all latest code down to your local branch on your machine, run black/ruff formatting, and then commit those changes back upstream. Only when that is done can we check if the PR is ready to be merged. |
okay @moonbox3 let me try it accordingly |
still 1 failing i don't know why? |
@Sarfaraz021 I just commited the formatting fix for you. |
Hi there @moonbox3 @eavanvalkenburg , I tried to commit the changes but now there seem some conflicts, |
We got this handled in a separate PR (#5596). We appreciate your help on initiating the PR/contribution. |
Pull request was closed
there are some errors in chat.add_user_message/assistant_message. You cannot just make chat as a object of ChatHistory, instead make it as
chat_history = ChatHistory(system_message=system_message)
also define service_id and pass it into kernel.add_service: such as :
service_id = "chat-gpt"
kernel.add_service(
sk_oai.OpenAIChatCompletion(
service_id="chat-gpt", ai_model_id="gpt-3.5-turbo", api_key=api_key)
)
Motivation and Context
Description
Contribution Checklist