zxs1633079383 commented on PR #870: URL: https://github.com/apache/flink-agents/pull/870#issuecomment-4911946964
Updated in 8477390 to address the request-scoped metric-group concern. What changed: - `BaseEmbeddingModelSetup.embed(...)` no longer records metrics from the setup resource's mutable bound metric group. The plain embedding API now only returns embeddings, so direct/shared setup calls cannot race through `Resource.metricGroup`. - Added explicit result/recording APIs: setup-level `embedWithUsage(...)` keeps provider usage with the returned embedding result, and `recordTokenMetrics(requestMetricGroup, usage)` records only against a caller-provided request/action metric group. - Java and Python vector-store auto-embedding now capture the vector store's current request metric group at the caller boundary and pass that explicit group into embedding metric recording. - Added regression tests proving metrics use the request-scoped group, skip when the group is absent, and do not read a later mutable bound metric group. Existing provider-failure/no-usage/batch usage coverage remains. Local verification: - `mvn --batch-mode --no-transfer-progress -pl api -Dtest=BaseEmbeddingModelSetupTokenMetricsTest test` - `mvn --batch-mode --no-transfer-progress -pl integrations/embedding-models/bedrock -am -Dtest=BedrockEmbeddingModelTest -Dsurefire.failIfNoSpecifiedTests=false test` - `uv run --python 3.12 --extra test pytest flink_agents/api/embedding_models/tests/test_token_metrics.py flink_agents/integrations/embedding_models/tests/test_openai_embedding_model.py flink_agents/integrations/embedding_models/tests/test_tongyi_embedding_model.py -q` - `uv run --python 3.12 --extra lint ruff format --check ... && uv run --python 3.12 --extra lint ruff check ...` - `git diff --check` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
