-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(google-common): Search grounding formatting #7471
fix(google-common): Search grounding formatting #7471
Conversation
…h grounding information.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
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.
Agh thanks. Remember to run yarn format
!
@@ -198,7 +198,7 @@ export class SimpleGoogleSearchOutputParser extends BaseGoogleSearchOutputParser | |||
|
|||
protected textSuffix(_text: string, grounding: GroundingInfo): string { | |||
let ret = "\n"; | |||
const chunks: GeminiGroundingChunk[] = grounding.metadata.groundingChunks; | |||
const chunks: GeminiGroundingChunk[] = grounding?.metadata?.groundingChunks ??[]; |
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.
nit: run yarn format
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.
Doh! Fixed
Thanks! |
Problem:
If using a subclass of
BaseGoogleSearchOutputParser
where the input doesn't have grounding info, it attempts to dereference undefined.Solution:
Return the input text, unchanged, if there is no grounding info to annotate.
Fix and tests for same.