-
Notifications
You must be signed in to change notification settings - Fork 38
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: update prompts and invalidate cache #493
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR adds functionality to update prompt labels and invalidate the cache in the Langfuse SDK. Here are the key changes:
- Changed HTTP method from PUT to PATCH in
updatePromptStateless
for more RESTful semantics - Added
updatePrompt
method inLangfuseCore
that updates labels and invalidates cache - Added test case verifying prompt label updates from ["john"] to ["john", "doe"]
- Note: Test is marked with .only() which should be removed before merging
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
const updatedPrompt = await langfuse.updatePrompt({ | ||
name: promptName, | ||
version: 1, | ||
newLabels: ["john", "doe"], | ||
}); |
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.
logic: Test should verify that old labels are preserved when updating with newLabels. Consider testing removal of labels and complete label replacement
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR adds functionality to update prompt labels and invalidate the cache in the Langfuse SDK. Here are the key changes:
- Added new PATCH endpoint
/api/public/v2/prompts/{promptName}/version/{version}
inopenapi-server.yaml
for updating prompt labels - Added
UpdatePromptBody
type definition intypes.ts
for the request payload - Added integration test in
langfuse-integration-node.spec.ts
verifying prompt label updates - Added prompt cache invalidation functionality in
promptCache.ts
Key points to note:
- Test is currently marked with .only() which should be removed before merging
- The PR properly handles cache invalidation when prompt labels are updated
- The OpenAPI spec changes align with the new functionality
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR adds functionality to update prompt labels and invalidate caching in the Langfuse SDK. Here are the key changes since the last review:
- Added
invalidate
method inLangfusePromptCache
to remove cache entries by promptName - Added OpenAPI spec for new PATCH endpoint
/api/public/v2/prompts/{promptName}/version/{version}
- Added integration test verifying prompt label updates and cache invalidation
- Added type definitions for prompt version updates in
types.ts
The changes look well-structured and properly tested. The only remaining item is to remove the .only()
from the test before merging.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR updates the OpenAPI server types to support prompt version updates and cache invalidation. Here are the key changes:
- Added new PATCH endpoint types in
langfuse-core/src/openapi/server.ts
for updating prompt version labels at/api/public/v2/prompts/{promptName}/version/{version}
- Made
unit
field required in Model schema by removing optional marker - Added
undefined
as valid type for MapValue schema
The changes are focused on type definitions to support the new prompt update functionality while maintaining type safety.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
This PR updates the OpenAPI specification and server types to support prompt version updates and cache invalidation in the Langfuse SDK.
- Added new PATCH endpoint
/api/public/v2/prompts/{promptName}/version/{version}
inopenapi-server.yaml
with corresponding type definitions - Made
unit
field optional in Model schema by adding?
to type definition inserver.ts
- Removed
undefined
as possible type from MapValue schema inserver.ts
- Improved string formatting consistency in OpenAPI spec descriptions
The changes are focused on API specification updates to properly support the new prompt update functionality while maintaining backwards compatibility.
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
Added new PATCH endpoint in OpenAPI spec for updating prompt version labels and invalidating cache, with key changes:
- Added
/api/public/v2/prompts/{promptName}/version/{version}
endpoint inlangfuse-core/openapi-spec/openapi-server.yaml
with proper authentication and error handling - Added
invalidate
method inlangfuse-core/src/prompts/promptCache.ts
to remove cache entries by promptName - Added
UpdatePromptBody
type definition inlangfuse-core/src/types.ts
for request payload validation
The changes provide a clean API for updating prompt labels while ensuring cache consistency.
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
newLabels: | ||
type: array | ||
items: | ||
type: string | ||
description: >- | ||
New labels for the prompt version. Labels are unique across | ||
versions. The 'latest' label is reserved and managed by | ||
Langfuse. |
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.
logic: newLabels array should validate that 'latest' is not included since it's a reserved label
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
Based on the provided files and previous reviews, I'll summarize the most recent changes:
Added new PATCH endpoint in OpenAPI spec for updating prompt version labels with comprehensive error handling and authentication.
- Added detailed response codes (200, 400, 401, 403, 404, 405) for
/api/public/v2/prompts/{promptName}/version/{version}
endpoint - Added security requirement for BasicAuth authentication on the new endpoint
- Added operation ID
promptVersion_update
for API documentation and client generation - Added description "Update labels for a specific prompt version" to clarify endpoint purpose
The changes focus on properly documenting the API contract for the new prompt version update functionality while maintaining security and error handling standards.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
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.
Disclaimer: Experimental PR review
PR Summary
(updates since last review)
Based on the recent changes shown in the files, here's a concise summary of the updates:
Removed test-only flag and added proper error handling for the prompt version update endpoint in the OpenAPI specification.
- Removed
.only
from test case inintegration-test/langfuse-integration-node.spec.ts
to enable all tests - Added comprehensive HTTP response codes (200, 400, 401, 403, 404, 405) for prompt version endpoint in
server.ts
- Added
undefined
as valid type for MapValue in OpenAPI schema for optional parameters - Added proper authentication requirements for the PATCH endpoint
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Important
Adds functionality to update prompt labels and invalidate cache with a new API endpoint and caching mechanism.
updatePrompt
method inLangfuseCore
to update prompt labels and invalidate cache.updatePromptStateless
inLangfuseCoreStateless
for API interaction.langfuse-integration-node.spec.ts
./api/public/v2/prompts/{promptName}/version/{version}
inopenapi-server.yaml
to update prompt labels.invalidate
method inLangfusePromptCache
to clear cache entries by prompt name.This description was created by for 4cf0625. It will automatically update as commits are pushed.