-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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: chat with compositeBrain ( with/out streaming) #1883
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
backend/llm/composite_brain_qa.py
Outdated
if not connected_brains: | ||
response = HeadlessQA( | ||
chat_id=chat_id, | ||
model=self.model, | ||
max_tokens=self.max_tokens, | ||
temperature=self.temperature, | ||
streaming=self.streaming, | ||
prompt_id=self.prompt_id, | ||
).generate_answer(chat_id, question) | ||
brain = brain_service.get_brain_by_id(self.brain_id) | ||
if save_answer: | ||
new_chat = chat_service.update_chat_history( | ||
CreateChatHistory( | ||
**{ | ||
"chat_id": chat_id, | ||
"user_message": question.question, | ||
"assistant": response.assistant, | ||
"brain_id": question.brain_id, | ||
"prompt_id": self.prompt_to_use_id, | ||
} | ||
) | ||
) |
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.
Maybe directly calling generate_answer of HeadlessQA
with save_answer = CURRENT_SAVE_ANSWER
?
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.
Something like :
def generate_answer(
self, chat_id: UUID, question: ChatQuestion, save_answer: bool
) -> str:
connected_brains = brain_service.get_connected_brains(self.brain_id)
if not connected_brains:
return HeadlessQA(
chat_id=chat_id,
model=self.model,
max_tokens=self.max_tokens,
temperature=self.temperature,
streaming=self.streaming,
prompt_id=self.prompt_id,
).generate_answer(chat_id, question, save_answer=save_answer)
0d4dfc7
to
3f62cff
Compare
2056eab
to
437c89c
Compare
🤖 I have created a release *beep* *boop* --- ## 0.0.141 (2023-12-15) ## What's Changed * feat[i18n]: Added i18n documenation to the contribution guidelines by @NilsJacobsen in #1899 * feat: Update Explore button label by @StanGirard in #1901 * feat: chat with compositeBrain ( with/out streaming) by @gozineb in #1883 * feat: update brains library by @mamadoudicko in #1903 **Full Changelog**: v0.0.140...v0.0.141 --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## 0.0.141 (2023-12-15) ## What's Changed * feat[i18n]: Added i18n documenation to the contribution guidelines by @NilsJacobsen in QuivrHQ/quivr#1899 * feat: Update Explore button label by @StanGirard in QuivrHQ/quivr#1901 * feat: chat with compositeBrain ( with/out streaming) by @gozineb in QuivrHQ/quivr#1883 * feat: update brains library by @mamadoudicko in QuivrHQ/quivr#1903 **Full Changelog**: QuivrHQ/quivr@v0.0.140...v0.0.141 --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
DONE
TODO