-
Notifications
You must be signed in to change notification settings - Fork 115
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: add Context Caching to Gemini plugins #1297
base: main
Are you sure you want to change the base?
Conversation
1421561
to
87b0185
Compare
docs(js/plugins/googleai): document context caching
87b0185
to
7f44d4c
Compare
b7a621b
to
6106b6f
Compare
Should wait for this fix: |
6106b6f
to
754f8f1
Compare
) => { | ||
return fromGeminiCandidate(candidate, jsonMode); | ||
}; | ||
let cache: CachedContent | null = null; |
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.
can we avoid this
}; | ||
let cache: CachedContent | null = null; | ||
|
||
// TODO: fix casting |
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.
fix todo
cache = handleContextCacheResponse.cache; | ||
} | ||
|
||
let genModel: GenerativeModel | null = null; |
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.
fix this
request: any, | ||
modelVersion: string | ||
): boolean { | ||
if (!modelVersion || !CONTEXT_CACHE_SUPPORTED_MODELS.includes(modelVersion)) { |
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.
this probably shouldn't throw - we should probably just return false
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.
It should probably throw if they try to use cache (cache is in metadata etc) but the model version is wrong. We don't want to accidentally cost them lots of tokens.
/** | ||
* Clears all caches using the cache manager. | ||
*/ | ||
export async function clearAllCaches( |
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.
this isnt actually used
TODO:
Checklist (if applicable):