Repository navigation
Release: attribute LLM gateway requests to their application purpose #260
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,10 +34,42 @@ public String requestHeader() { | |
| } | ||
|
|
||
| /** Returns the stable Java Chat workload label for this request tier. */ | ||
| public String workloadHeader(String operation) { | ||
| if (operation == null || operation.isBlank()) { | ||
| throw new IllegalArgumentException("operation must be non-blank"); | ||
| public String workloadHeader(Purpose purpose) { | ||
| return "java-chat:" + java.util.Objects.requireNonNull(purpose, "purpose").label + ":" | ||
| + (this == LIVE ? "live" : "batch"); | ||
| } | ||
|
|
||
| /** Identifies the application job independently of its wire protocol and capacity tier. */ | ||
| public enum Purpose { | ||
| /** Answers a chat question. */ | ||
| CHAT_ANSWER("chatAnswer"), | ||
| /** Generates a guided lesson. */ | ||
| GUIDED_LEARNING("guidedLearning"), | ||
| /** Enriches rendered markdown. */ | ||
| MARKDOWN_ENRICHMENT("markdownEnrichment"), | ||
| /** Ranks retrieved search candidates. */ | ||
| SEARCH_RERANK("searchRerank"), | ||
| /** Embeds a live retrieval query. */ | ||
| SEARCH_QUERY_EMBEDDING("searchQueryEmbedding"), | ||
| /** Embeds content supplied directly to the batch executor. */ | ||
| CONTENT_INDEX_EMBEDDING("contentIndexEmbedding"), | ||
|
Comment on lines
+54
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AGENTS.md reference: AGENTS.md:L104-L104 Useful? React with 👍 / 👎. |
||
| /** Indexes repository source files. */ | ||
| REPOSITORY_INDEX_EMBEDDING("repositoryIndexEmbedding"), | ||
| /** Indexes documentation. */ | ||
| DOCUMENTATION_INDEX_EMBEDDING("documentationIndexEmbedding"), | ||
| /** Indexes book content. */ | ||
| BOOK_INDEX_EMBEDDING("bookIndexEmbedding"), | ||
| /** Indexes articles. */ | ||
| ARTICLE_INDEX_EMBEDDING("articleIndexEmbedding"), | ||
| /** Indexes PDF content. */ | ||
| PDF_INDEX_EMBEDDING("pdfIndexEmbedding"), | ||
| /** Keeps the embedding model resident. */ | ||
| EMBEDDING_WARMUP("embeddingWarmup"); | ||
|
|
||
| private final String label; | ||
|
|
||
| Purpose(String label) { | ||
| this.label = label; | ||
| } | ||
| return "java-chat:" + operation + ":" + (this == LIVE ? "live" : "batch"); | ||
| } | ||
| } | ||
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 change makes
purpose,texts, andrequestTiera three-parameter group that is forwarded together through the default methods, implementations, batching layer, and callers. Introduce a typed embedding-request record instead of propagating this new data clump across every boundary.AGENTS.md reference: AGENTS.md:L200-L200
Useful? React with 👍 / 👎.