-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: GPT35Generator
#5714
feat: GPT35Generator
#5714
Conversation
A small note on naming, a ChatGPTGenerator that does not support chat feels a bit confusing to me. |
Good point 👀 Things should clear up as soon as the Agents proposal takes shape. At that point we will rework this very simple component into something more powerful and/or clarify better what it can and can't do. It is in no way feature complete, final or anything. It's just a simple component to make RAG possible in v2. Let's keep iterating! @mathislucka @sjrl I might rename it |
That sounds better I think. |
@ZanSara hey I see there are some more places with |
Thank you! I'm having another pass 🙌 |
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.
Great work!
I took a general look and I have some high-level doubts.
(Probably many of these points are about legitimate implementation choices or future developments to be done in separate PRs...)
-
Although it has already been discussed, the naming sounds strange to me. I would not expect that I can use the
GPT35Generator
to run GPT4. Other options:OpenAIGenerator
,OpenAIGPTGenerator
,... -
(Partly related to the previous point?) This component does not support the legacy Completions API, supported in Haystack 1.x. Although declared legacy, the Completions API will be probably retired in 2024. Don't we want to support it in Haystack 2.x? (It may well be a reasonable choice)
-
What happens if the user enters a wrong model name? Is it ok to let the OpenAI SDK raise an error or do we want to intercept it in Haystack?
-
What happens if the user sends a prompt that fills/exceeds the context window?
-
Maybe the OpenAI organization should be declared in
__init__
and then used. See feat: supportOpenAI-Organization
for authentication #5292. -
Azure ChatGPT Generator
(corresponding to this invocation layer) will be addressed in another PR. Right?
Co-authored-by: Daria Fokina <[email protected]>
Ok let's take them one by one:
I plan to make a subclass called
If we do, I'd rather support them into a dedicated generator that we will be able to deprecate easily when the time comes.
Good point! I'll check how the error looks like. I expect it to be quite clear, if it is I'll let it go across. Otherwise I'll figure out a way to communicate it to the user better..
Right! I'll add a test!
Ah right! It got lost in the last refactoring. Let me bring it back.
Yes Azure support is for the next PR 🙂 |
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.
👍
* chatgpt backend * fix tests * reno * remove print * helpers tests * add chatgpt generator * use openai sdk * remove backend * tests are broken * fix tests * stray param * move _check_troncated_answers into the class * wrong import * rename function * typo in test * add openai deps * mypy * improve system prompt docstring * typos update * Update haystack/preview/components/generators/openai/chatgpt.py * pylint * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <[email protected]> * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <[email protected]> * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <[email protected]> * review feedback * fix tests * freview feedback * reno * remove tenacity mock * gpt35generator * fix naming * remove stray references to chatgpt * fix e2e * Update releasenotes/notes/chatgpt-llm-generator-d043532654efe684.yaml Co-authored-by: Daria Fokina <[email protected]> * add another test * test wrong model name * review feedback --------- Co-authored-by: Daria Fokina <[email protected]> Co-authored-by: Silvano Cerza <[email protected]>
Related Issues
Proposed Changes:
ChatGPTGenerator
How did you test it?
Notes for the reviewer
openai
already added tohaystack-ai
: deepset-ai/haystack-preview-package#2Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.