-
Notifications
You must be signed in to change notification settings - Fork 0
New bug fix #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
base: main
Are you sure you want to change the base?
New bug fix #2
Conversation
CodeAnt AI is reviewing your PR. |
print(f"Retrieved documents: {len(docs)}") | ||
#Prepare relevant documents for inclusion in final prompt | ||
relevant_docs = "" | ||
talkTogemini() |
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.
Suggestion: Remove the erroneous call to talkTogemini()
inside the talkToGemini
function to prevent unintended recursion and a NameError. [possible bug]
talkTogemini() |
Why this change?
The call to `talkTogemini()` inside `talkToGemini` causes unintended recursion and will likely raise a NameError because the function name is mis-cased. Removing this line prevents infinite recursion and runtime errors, while preserving the intended flow of similarity search and document processing.
Pull Request Feedback 🔍
|
CodeAnt AI finished reviewing your PR. |
what is undefined variable? - it looks ok to me - @CodeAnt-AI |
@CodeAnt-AI, what is undefined variable? - it looks ok to me |
@CodeAnt-AI why unused variable? |
Question: -ai, what is undefined variable? - it looks ok to me Answer:
(with a capital “G”), but you’re calling Even if you corrected the casing to match ( To fix:
In short, remove or replace the rogue |
Question: -ai why unused variable? Answer: llm_vision = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
message = HumanMessage(
content=[
{
"type": "text",
"text": "You are a professional interior designer, give me a detailed description…",
},
],
)
# … but then you never do something like:
# response = llm_vision([message])
# so `message` just sits there unused. In other words, you intended to feed that Two ways to fix it:
Either approach will solve the “unused variable” warning. |
@CodeAnt-AI , code is already as per your comment only |
Question: //github.com/user-attachments/assets/396c4f5a-be08-4c2b-9fe4-41c1db3d593c" /> Answer:
Putting it all together, an example of how you might actually “trigger the pipeline” without self-calling would be: def talkToGemini():
# 1) parse
prompt = request.json.get("message")
if not prompt:
return jsonify(error="`message` field missing"), 400
prompt = unquote(prompt)
# 2) vision → description
llm_vision = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
vision_msg = HumanMessage(content=[
{"type": "text",
"text": "You are a professional interior designer…"}
])
vision_resp = llm_vision.generate([vision_msg])
room_desc = vision_resp.content
# 3) similarity search
vs_prompt = f"User wants: {prompt}. Room style: {room_desc}"
docs = vectorstore.similarity_search(vs_prompt)
# 4) final LLM call (your actual “pipeline trigger”)
llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
design_msg = HumanMessage(content=[
{"type":"text",
"text": f"Based on these docs {docs} and prompt {prompt}, ..."}
])
final_resp = llm.generate([design_msg])
return jsonify(response=final_resp.content) That way there’s no self-recursion, your pipeline is clearly invoked exactly once, and each step is testable. Let me know if that helps clarify the fix you were aiming for! |
@CodeAnt-AI , its there, line no: 81-84 |
Question: 81-84 Answer:
At a high level, this is fine—but there are a few tweaks and hardening steps I would recommend:
Putting it all together will make the code more robust, easier to troubleshoot when something goes wrong, and more consistent with typical production standards. |
@CodeAnt-AI but this doesn't have unused variable warning right? |
Question: -ai but this doesn't have unused variable warning right? Answer: That said, I do see a bug lurking here:
Suggested fix (one of the two): A) If your intent was to warm up / trigger the model before processing the docs, rename the call to the correct function and (optionally) capture its output: # inside talkToGemini
# …after building docs…
# Kick off a warm-up call, discard result
talkToGemini() # careful! this recurses into itself
# OR capture output:
_ = talkToGemini() B) If you meant a separate helper, define it (for example): def initGeminiVision():
# maybe you wanted to call ChatGoogleGenerativeAI(model="gemini-1.5-flash").generate([...])
return llm_vision.generate([...])
def talkToGemini():
# …
initGeminiVision() # this is now clearly defined
for doc in docs:
# … Either way, no linter will complain about an unused variable here, but you will run into a runtime error unless the function actually exists or you rename it correctly. |
User description
Background
Fixes
Change Summary
Additional Notes
Testing Procedure
Related PRs or Issues
CodeAnt-AI Description
talkTogemini()
inside thetalkToGemini
function before iterating over the similarity search results.This update ensures the chat assistant pipeline is explicitly triggered during document retrieval, fixing the missing invocation and improving code clarity.
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.