shield360 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +310 -0
- package/dist/__tests__/manual-trace.test.d.ts +1 -0
- package/dist/__tests__/manual-trace.test.js +118 -0
- package/dist/__tests__/manual-trace.test.js.map +1 -0
- package/dist/__tests__/register.test.d.ts +0 -0
- package/dist/__tests__/register.test.js +90 -0
- package/dist/__tests__/register.test.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/constant.d.ts +6 -0
- package/dist/constant.js +14 -0
- package/dist/constant.js.map +1 -0
- package/dist/evals/__tests__/offline.test.d.ts +1 -0
- package/dist/evals/__tests__/offline.test.js +427 -0
- package/dist/evals/__tests__/offline.test.js.map +1 -0
- package/dist/evals/index.d.ts +2 -0
- package/dist/evals/index.js +15 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/offline.d.ts +6 -0
- package/dist/evals/offline.js +350 -0
- package/dist/evals/offline.js.map +1 -0
- package/dist/evals/types.d.ts +74 -0
- package/dist/evals/types.js +23 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/features/__tests__/rule-engine.test.d.ts +1 -0
- package/dist/features/__tests__/rule-engine.test.js +146 -0
- package/dist/features/__tests__/rule-engine.test.js.map +1 -0
- package/dist/features/base.d.ts +8 -0
- package/dist/features/base.js +15 -0
- package/dist/features/base.js.map +1 -0
- package/dist/features/prompt-hub.d.ts +4 -0
- package/dist/features/prompt-hub.js +66 -0
- package/dist/features/prompt-hub.js.map +1 -0
- package/dist/features/rule-engine.d.ts +6 -0
- package/dist/features/rule-engine.js +60 -0
- package/dist/features/rule-engine.js.map +1 -0
- package/dist/features/vault.d.ts +4 -0
- package/dist/features/vault.js +63 -0
- package/dist/features/vault.js.map +1 -0
- package/dist/guard/__tests__/findings.test.d.ts +1 -0
- package/dist/guard/__tests__/findings.test.js +79 -0
- package/dist/guard/__tests__/findings.test.js.map +1 -0
- package/dist/guard/__tests__/integration.test.d.ts +1 -0
- package/dist/guard/__tests__/integration.test.js +215 -0
- package/dist/guard/__tests__/integration.test.js.map +1 -0
- package/dist/guard/__tests__/pii.test.d.ts +1 -0
- package/dist/guard/__tests__/pii.test.js +131 -0
- package/dist/guard/__tests__/pii.test.js.map +1 -0
- package/dist/guard/__tests__/pipeline.test.d.ts +1 -0
- package/dist/guard/__tests__/pipeline.test.js +162 -0
- package/dist/guard/__tests__/pipeline.test.js.map +1 -0
- package/dist/guard/__tests__/prompt-injection.test.d.ts +1 -0
- package/dist/guard/__tests__/prompt-injection.test.js +92 -0
- package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
- package/dist/guard/__tests__/report.test.d.ts +1 -0
- package/dist/guard/__tests__/report.test.js +50 -0
- package/dist/guard/__tests__/report.test.js.map +1 -0
- package/dist/guard/base.d.ts +79 -0
- package/dist/guard/base.js +136 -0
- package/dist/guard/base.js.map +1 -0
- package/dist/guard/custom.d.ts +19 -0
- package/dist/guard/custom.js +46 -0
- package/dist/guard/custom.js.map +1 -0
- package/dist/guard/findings.d.ts +31 -0
- package/dist/guard/findings.js +156 -0
- package/dist/guard/findings.js.map +1 -0
- package/dist/guard/index.d.ts +24 -0
- package/dist/guard/index.js +42 -0
- package/dist/guard/index.js.map +1 -0
- package/dist/guard/integration.d.ts +44 -0
- package/dist/guard/integration.js +363 -0
- package/dist/guard/integration.js.map +1 -0
- package/dist/guard/moderation.d.ts +18 -0
- package/dist/guard/moderation.js +61 -0
- package/dist/guard/moderation.js.map +1 -0
- package/dist/guard/pii.d.ts +17 -0
- package/dist/guard/pii.js +114 -0
- package/dist/guard/pii.js.map +1 -0
- package/dist/guard/pipeline.d.ts +26 -0
- package/dist/guard/pipeline.js +139 -0
- package/dist/guard/pipeline.js.map +1 -0
- package/dist/guard/prompt-injection.d.ts +21 -0
- package/dist/guard/prompt-injection.js +70 -0
- package/dist/guard/prompt-injection.js.map +1 -0
- package/dist/guard/report.d.ts +34 -0
- package/dist/guard/report.js +182 -0
- package/dist/guard/report.js.map +1 -0
- package/dist/guard/schema.d.ts +20 -0
- package/dist/guard/schema.js +99 -0
- package/dist/guard/schema.js.map +1 -0
- package/dist/guard/sensitive-topic.d.ts +23 -0
- package/dist/guard/sensitive-topic.js +89 -0
- package/dist/guard/sensitive-topic.js.map +1 -0
- package/dist/guard/topic-restriction.d.ts +22 -0
- package/dist/guard/topic-restriction.js +54 -0
- package/dist/guard/topic-restriction.js.map +1 -0
- package/dist/helpers.d.ts +246 -0
- package/dist/helpers.js +903 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js +176 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.d.ts +10 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js +203 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js +160 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js +171 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.d.ts +15 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js +155 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js.map +1 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.d.ts +18 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +209 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js +256 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js +238 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +229 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js +247 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js +391 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +687 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.d.ts +14 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js +347 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js.map +1 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +529 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js +19 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js +285 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js +208 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +206 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +345 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js +179 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.d.ts +21 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js +455 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +182 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +346 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js +289 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.d.ts +67 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js +255 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js.map +1 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js +214 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.d.ts +6 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js +409 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js +519 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/ai21/index.d.ts +11 -0
- package/dist/instrumentation/ai21/index.js +67 -0
- package/dist/instrumentation/ai21/index.js.map +1 -0
- package/dist/instrumentation/ai21/wrapper.d.ts +54 -0
- package/dist/instrumentation/ai21/wrapper.js +511 -0
- package/dist/instrumentation/ai21/wrapper.js.map +1 -0
- package/dist/instrumentation/anthropic/index.d.ts +11 -0
- package/dist/instrumentation/anthropic/index.js +45 -0
- package/dist/instrumentation/anthropic/index.js.map +1 -0
- package/dist/instrumentation/anthropic/wrapper.d.ts +34 -0
- package/dist/instrumentation/anthropic/wrapper.js +426 -0
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -0
- package/dist/instrumentation/assemblyai/index.d.ts +12 -0
- package/dist/instrumentation/assemblyai/index.js +91 -0
- package/dist/instrumentation/assemblyai/index.js.map +1 -0
- package/dist/instrumentation/assemblyai/wrapper.d.ts +35 -0
- package/dist/instrumentation/assemblyai/wrapper.js +238 -0
- package/dist/instrumentation/assemblyai/wrapper.js.map +1 -0
- package/dist/instrumentation/astra/index.d.ts +11 -0
- package/dist/instrumentation/astra/index.js +87 -0
- package/dist/instrumentation/astra/index.js.map +1 -0
- package/dist/instrumentation/astra/wrapper.d.ts +39 -0
- package/dist/instrumentation/astra/wrapper.js +349 -0
- package/dist/instrumentation/astra/wrapper.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
- package/dist/instrumentation/azure-ai-inference/index.js +76 -0
- package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +55 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js +580 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
- package/dist/instrumentation/base-wrapper.d.ts +16 -0
- package/dist/instrumentation/base-wrapper.js +139 -0
- package/dist/instrumentation/base-wrapper.js.map +1 -0
- package/dist/instrumentation/bedrock/index.d.ts +11 -0
- package/dist/instrumentation/bedrock/index.js +52 -0
- package/dist/instrumentation/bedrock/index.js.map +1 -0
- package/dist/instrumentation/bedrock/wrapper.d.ts +41 -0
- package/dist/instrumentation/bedrock/wrapper.js +494 -0
- package/dist/instrumentation/bedrock/wrapper.js.map +1 -0
- package/dist/instrumentation/browser-use/index.d.ts +11 -0
- package/dist/instrumentation/browser-use/index.js +98 -0
- package/dist/instrumentation/browser-use/index.js.map +1 -0
- package/dist/instrumentation/browser-use/wrapper.d.ts +12 -0
- package/dist/instrumentation/browser-use/wrapper.js +706 -0
- package/dist/instrumentation/browser-use/wrapper.js.map +1 -0
- package/dist/instrumentation/chroma/index.d.ts +11 -0
- package/dist/instrumentation/chroma/index.js +70 -0
- package/dist/instrumentation/chroma/index.js.map +1 -0
- package/dist/instrumentation/chroma/wrapper.d.ts +10 -0
- package/dist/instrumentation/chroma/wrapper.js +127 -0
- package/dist/instrumentation/chroma/wrapper.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
- package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
- package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js +1123 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/cohere/index.d.ts +11 -0
- package/dist/instrumentation/cohere/index.js +53 -0
- package/dist/instrumentation/cohere/index.js.map +1 -0
- package/dist/instrumentation/cohere/wrapper.d.ts +50 -0
- package/dist/instrumentation/cohere/wrapper.js +452 -0
- package/dist/instrumentation/cohere/wrapper.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
- package/dist/instrumentation/cursor-sdk/index.js +58 -0
- package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js +789 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/elevenlabs/index.d.ts +12 -0
- package/dist/instrumentation/elevenlabs/index.js +92 -0
- package/dist/instrumentation/elevenlabs/index.js.map +1 -0
- package/dist/instrumentation/elevenlabs/wrapper.d.ts +34 -0
- package/dist/instrumentation/elevenlabs/wrapper.js +280 -0
- package/dist/instrumentation/elevenlabs/wrapper.js.map +1 -0
- package/dist/instrumentation/firecrawl/index.d.ts +13 -0
- package/dist/instrumentation/firecrawl/index.js +115 -0
- package/dist/instrumentation/firecrawl/index.js.map +1 -0
- package/dist/instrumentation/firecrawl/wrapper.d.ts +22 -0
- package/dist/instrumentation/firecrawl/wrapper.js +378 -0
- package/dist/instrumentation/firecrawl/wrapper.js.map +1 -0
- package/dist/instrumentation/google-adk/index.d.ts +57 -0
- package/dist/instrumentation/google-adk/index.js +371 -0
- package/dist/instrumentation/google-adk/index.js.map +1 -0
- package/dist/instrumentation/google-adk/utils.d.ts +45 -0
- package/dist/instrumentation/google-adk/utils.js +663 -0
- package/dist/instrumentation/google-adk/utils.js.map +1 -0
- package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
- package/dist/instrumentation/google-adk/wrapper.js +391 -0
- package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
- package/dist/instrumentation/google-ai/index.d.ts +11 -0
- package/dist/instrumentation/google-ai/index.js +48 -0
- package/dist/instrumentation/google-ai/index.js.map +1 -0
- package/dist/instrumentation/google-ai/wrapper.d.ts +52 -0
- package/dist/instrumentation/google-ai/wrapper.js +466 -0
- package/dist/instrumentation/google-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/gpu/index.d.ts +38 -0
- package/dist/instrumentation/gpu/index.js +233 -0
- package/dist/instrumentation/gpu/index.js.map +1 -0
- package/dist/instrumentation/gradient/index.d.ts +12 -0
- package/dist/instrumentation/gradient/index.js +74 -0
- package/dist/instrumentation/gradient/index.js.map +1 -0
- package/dist/instrumentation/gradient/utils.d.ts +14 -0
- package/dist/instrumentation/gradient/utils.js +119 -0
- package/dist/instrumentation/gradient/utils.js.map +1 -0
- package/dist/instrumentation/gradient/wrapper.d.ts +76 -0
- package/dist/instrumentation/gradient/wrapper.js +584 -0
- package/dist/instrumentation/gradient/wrapper.js.map +1 -0
- package/dist/instrumentation/groq/index.d.ts +11 -0
- package/dist/instrumentation/groq/index.js +43 -0
- package/dist/instrumentation/groq/index.js.map +1 -0
- package/dist/instrumentation/groq/wrapper.d.ts +35 -0
- package/dist/instrumentation/groq/wrapper.js +442 -0
- package/dist/instrumentation/groq/wrapper.js.map +1 -0
- package/dist/instrumentation/huggingface/index.d.ts +13 -0
- package/dist/instrumentation/huggingface/index.js +110 -0
- package/dist/instrumentation/huggingface/index.js.map +1 -0
- package/dist/instrumentation/huggingface/wrapper.d.ts +54 -0
- package/dist/instrumentation/huggingface/wrapper.js +514 -0
- package/dist/instrumentation/huggingface/wrapper.js.map +1 -0
- package/dist/instrumentation/index.d.ts +7 -0
- package/dist/instrumentation/index.js +176 -0
- package/dist/instrumentation/index.js.map +1 -0
- package/dist/instrumentation/langchain/index.d.ts +16 -0
- package/dist/instrumentation/langchain/index.js +91 -0
- package/dist/instrumentation/langchain/index.js.map +1 -0
- package/dist/instrumentation/langchain/wrapper.d.ts +41 -0
- package/dist/instrumentation/langchain/wrapper.js +1235 -0
- package/dist/instrumentation/langchain/wrapper.js.map +1 -0
- package/dist/instrumentation/langgraph/index.d.ts +12 -0
- package/dist/instrumentation/langgraph/index.js +99 -0
- package/dist/instrumentation/langgraph/index.js.map +1 -0
- package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
- package/dist/instrumentation/langgraph/wrapper.js +620 -0
- package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
- package/dist/instrumentation/letta/index.d.ts +10 -0
- package/dist/instrumentation/letta/index.js +122 -0
- package/dist/instrumentation/letta/index.js.map +1 -0
- package/dist/instrumentation/letta/utils.d.ts +24 -0
- package/dist/instrumentation/letta/utils.js +343 -0
- package/dist/instrumentation/letta/utils.js.map +1 -0
- package/dist/instrumentation/letta/wrapper.d.ts +37 -0
- package/dist/instrumentation/letta/wrapper.js +180 -0
- package/dist/instrumentation/letta/wrapper.js.map +1 -0
- package/dist/instrumentation/llamaindex/index.d.ts +36 -0
- package/dist/instrumentation/llamaindex/index.js +221 -0
- package/dist/instrumentation/llamaindex/index.js.map +1 -0
- package/dist/instrumentation/llamaindex/wrapper.d.ts +36 -0
- package/dist/instrumentation/llamaindex/wrapper.js +811 -0
- package/dist/instrumentation/llamaindex/wrapper.js.map +1 -0
- package/dist/instrumentation/mcp/index.d.ts +20 -0
- package/dist/instrumentation/mcp/index.js +282 -0
- package/dist/instrumentation/mcp/index.js.map +1 -0
- package/dist/instrumentation/mcp/wrapper.d.ts +72 -0
- package/dist/instrumentation/mcp/wrapper.js +571 -0
- package/dist/instrumentation/mcp/wrapper.js.map +1 -0
- package/dist/instrumentation/mem0/index.d.ts +17 -0
- package/dist/instrumentation/mem0/index.js +113 -0
- package/dist/instrumentation/mem0/index.js.map +1 -0
- package/dist/instrumentation/mem0/wrapper.d.ts +37 -0
- package/dist/instrumentation/mem0/wrapper.js +298 -0
- package/dist/instrumentation/mem0/wrapper.js.map +1 -0
- package/dist/instrumentation/milvus/index.d.ts +11 -0
- package/dist/instrumentation/milvus/index.js +67 -0
- package/dist/instrumentation/milvus/index.js.map +1 -0
- package/dist/instrumentation/milvus/wrapper.d.ts +15 -0
- package/dist/instrumentation/milvus/wrapper.js +219 -0
- package/dist/instrumentation/milvus/wrapper.js.map +1 -0
- package/dist/instrumentation/mistral/index.d.ts +11 -0
- package/dist/instrumentation/mistral/index.js +66 -0
- package/dist/instrumentation/mistral/index.js.map +1 -0
- package/dist/instrumentation/mistral/wrapper.d.ts +49 -0
- package/dist/instrumentation/mistral/wrapper.js +482 -0
- package/dist/instrumentation/mistral/wrapper.js.map +1 -0
- package/dist/instrumentation/ollama/index.d.ts +11 -0
- package/dist/instrumentation/ollama/index.js +72 -0
- package/dist/instrumentation/ollama/index.js.map +1 -0
- package/dist/instrumentation/ollama/wrapper.d.ts +73 -0
- package/dist/instrumentation/ollama/wrapper.js +629 -0
- package/dist/instrumentation/ollama/wrapper.js.map +1 -0
- package/dist/instrumentation/openai/index.d.ts +11 -0
- package/dist/instrumentation/openai/index.js +79 -0
- package/dist/instrumentation/openai/index.js.map +1 -0
- package/dist/instrumentation/openai/wrapper.d.ts +80 -0
- package/dist/instrumentation/openai/wrapper.js +1121 -0
- package/dist/instrumentation/openai/wrapper.js.map +1 -0
- package/dist/instrumentation/openai-agents/index.d.ts +20 -0
- package/dist/instrumentation/openai-agents/index.js +174 -0
- package/dist/instrumentation/openai-agents/index.js.map +1 -0
- package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
- package/dist/instrumentation/openai-agents/processor.js +249 -0
- package/dist/instrumentation/openai-agents/processor.js.map +1 -0
- package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
- package/dist/instrumentation/openai-agents/utils.js +624 -0
- package/dist/instrumentation/openai-agents/utils.js.map +1 -0
- package/dist/instrumentation/pg/index.d.ts +20 -0
- package/dist/instrumentation/pg/index.js +74 -0
- package/dist/instrumentation/pg/index.js.map +1 -0
- package/dist/instrumentation/pg/wrapper.d.ts +66 -0
- package/dist/instrumentation/pg/wrapper.js +441 -0
- package/dist/instrumentation/pg/wrapper.js.map +1 -0
- package/dist/instrumentation/pinecone/index.d.ts +11 -0
- package/dist/instrumentation/pinecone/index.js +79 -0
- package/dist/instrumentation/pinecone/index.js.map +1 -0
- package/dist/instrumentation/pinecone/wrapper.d.ts +14 -0
- package/dist/instrumentation/pinecone/wrapper.js +198 -0
- package/dist/instrumentation/pinecone/wrapper.js.map +1 -0
- package/dist/instrumentation/qdrant/index.d.ts +11 -0
- package/dist/instrumentation/qdrant/index.js +67 -0
- package/dist/instrumentation/qdrant/index.js.map +1 -0
- package/dist/instrumentation/qdrant/wrapper.d.ts +14 -0
- package/dist/instrumentation/qdrant/wrapper.js +213 -0
- package/dist/instrumentation/qdrant/wrapper.js.map +1 -0
- package/dist/instrumentation/replicate/index.d.ts +11 -0
- package/dist/instrumentation/replicate/index.js +57 -0
- package/dist/instrumentation/replicate/index.js.map +1 -0
- package/dist/instrumentation/replicate/wrapper.d.ts +28 -0
- package/dist/instrumentation/replicate/wrapper.js +242 -0
- package/dist/instrumentation/replicate/wrapper.js.map +1 -0
- package/dist/instrumentation/strands/index.d.ts +21 -0
- package/dist/instrumentation/strands/index.js +83 -0
- package/dist/instrumentation/strands/index.js.map +1 -0
- package/dist/instrumentation/strands/processor.d.ts +51 -0
- package/dist/instrumentation/strands/processor.js +625 -0
- package/dist/instrumentation/strands/processor.js.map +1 -0
- package/dist/instrumentation/strands/utils.d.ts +24 -0
- package/dist/instrumentation/strands/utils.js +373 -0
- package/dist/instrumentation/strands/utils.js.map +1 -0
- package/dist/instrumentation/together/index.d.ts +11 -0
- package/dist/instrumentation/together/index.js +43 -0
- package/dist/instrumentation/together/index.js.map +1 -0
- package/dist/instrumentation/together/wrapper.d.ts +48 -0
- package/dist/instrumentation/together/wrapper.js +409 -0
- package/dist/instrumentation/together/wrapper.js.map +1 -0
- package/dist/instrumentation/transformers/index.d.ts +35 -0
- package/dist/instrumentation/transformers/index.js +119 -0
- package/dist/instrumentation/transformers/index.js.map +1 -0
- package/dist/instrumentation/transformers/wrapper.d.ts +49 -0
- package/dist/instrumentation/transformers/wrapper.js +472 -0
- package/dist/instrumentation/transformers/wrapper.js.map +1 -0
- package/dist/instrumentation/vercel-ai/index.d.ts +10 -0
- package/dist/instrumentation/vercel-ai/index.js +59 -0
- package/dist/instrumentation/vercel-ai/index.js.map +1 -0
- package/dist/instrumentation/vercel-ai/wrapper.d.ts +50 -0
- package/dist/instrumentation/vercel-ai/wrapper.js +539 -0
- package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/vertexai/index.d.ts +11 -0
- package/dist/instrumentation/vertexai/index.js +70 -0
- package/dist/instrumentation/vertexai/index.js.map +1 -0
- package/dist/instrumentation/vertexai/wrapper.d.ts +67 -0
- package/dist/instrumentation/vertexai/wrapper.js +530 -0
- package/dist/instrumentation/vertexai/wrapper.js.map +1 -0
- package/dist/instrumentation/vllm/index.d.ts +13 -0
- package/dist/instrumentation/vllm/index.js +67 -0
- package/dist/instrumentation/vllm/index.js.map +1 -0
- package/dist/instrumentation/vllm/wrapper.d.ts +60 -0
- package/dist/instrumentation/vllm/wrapper.js +482 -0
- package/dist/instrumentation/vllm/wrapper.js.map +1 -0
- package/dist/llm/anthropic.d.ts +5 -0
- package/dist/llm/anthropic.js +39 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.js +93 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/openai.d.ts +6 -0
- package/dist/llm/openai.js +52 -0
- package/dist/llm/openai.js.map +1 -0
- package/dist/llm/providers.d.ts +7 -0
- package/dist/llm/providers.js +10 -0
- package/dist/llm/providers.js.map +1 -0
- package/dist/manual-trace.d.ts +40 -0
- package/dist/manual-trace.js +103 -0
- package/dist/manual-trace.js.map +1 -0
- package/dist/otel/__tests__/metrics.test.d.ts +1 -0
- package/dist/otel/__tests__/metrics.test.js +40 -0
- package/dist/otel/__tests__/metrics.test.js.map +1 -0
- package/dist/otel/events.d.ts +11 -0
- package/dist/otel/events.js +74 -0
- package/dist/otel/events.js.map +1 -0
- package/dist/otel/metrics.d.ts +35 -0
- package/dist/otel/metrics.js +219 -0
- package/dist/otel/metrics.js.map +1 -0
- package/dist/otel/tracing.d.ts +12 -0
- package/dist/otel/tracing.js +93 -0
- package/dist/otel/tracing.js.map +1 -0
- package/dist/otel/utils.d.ts +11 -0
- package/dist/otel/utils.js +34 -0
- package/dist/otel/utils.js.map +1 -0
- package/dist/pricing.json +951 -0
- package/dist/prompt-hub.d.ts +4 -0
- package/dist/prompt-hub.js +66 -0
- package/dist/prompt-hub.js.map +1 -0
- package/dist/register.d.ts +4 -0
- package/dist/register.js +52 -0
- package/dist/register.js.map +1 -0
- package/dist/score/__tests__/score.test.d.ts +1 -0
- package/dist/score/__tests__/score.test.js +143 -0
- package/dist/score/__tests__/score.test.js.map +1 -0
- package/dist/score/index.d.ts +2 -0
- package/dist/score/index.js +6 -0
- package/dist/score/index.js.map +1 -0
- package/dist/score/score.d.ts +15 -0
- package/dist/score/score.js +135 -0
- package/dist/score/score.js.map +1 -0
- package/dist/semantic-convention.d.ts +555 -0
- package/dist/semantic-convention.js +630 -0
- package/dist/semantic-convention.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +136 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-Language Trace Comparison Tests for Google AI Studio Integration
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const api_1 = require("@opentelemetry/api");
|
|
10
|
+
const wrapper_1 = __importDefault(require("../google-ai/wrapper"));
|
|
11
|
+
const config_1 = __importDefault(require("../../config"));
|
|
12
|
+
const helpers_1 = __importDefault(require("../../helpers"));
|
|
13
|
+
const base_wrapper_1 = __importDefault(require("../base-wrapper"));
|
|
14
|
+
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
15
|
+
jest.mock('../../config');
|
|
16
|
+
jest.mock('../../helpers');
|
|
17
|
+
jest.mock('../base-wrapper');
|
|
18
|
+
const mockTracer = api_1.trace.getTracer('test-tracer');
|
|
19
|
+
describe('Google AI Studio Cross-Language Trace Comparison', () => {
|
|
20
|
+
let mockSpan;
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
mockSpan = mockTracer.startSpan('test-span');
|
|
23
|
+
mockSpan.setAttribute = jest.fn();
|
|
24
|
+
mockSpan.addEvent = jest.fn();
|
|
25
|
+
mockSpan.end = jest.fn();
|
|
26
|
+
mockSpan.setStatus = jest.fn();
|
|
27
|
+
config_1.default.environment = 'shield360-testing';
|
|
28
|
+
config_1.default.applicationName = 'shield360-test';
|
|
29
|
+
config_1.default.captureMessageContent = true;
|
|
30
|
+
config_1.default.pricingInfo = {};
|
|
31
|
+
config_1.default.disableEvents = false;
|
|
32
|
+
helpers_1.default.getChatModelCost = jest.fn().mockReturnValue(0.001);
|
|
33
|
+
helpers_1.default.handleException = jest.fn();
|
|
34
|
+
helpers_1.default.createStreamProxy = jest.fn().mockImplementation((stream, _generator) => stream);
|
|
35
|
+
helpers_1.default.buildInputMessages = jest.fn().mockReturnValue('[{"role":"user","parts":[{"type":"text","content":"What is Gemini?"}]}]');
|
|
36
|
+
helpers_1.default.buildOutputMessages = jest.fn().mockReturnValue('[{"role":"assistant","parts":[{"type":"text","content":"Gemini is Google\'s AI model"}],"finish_reason":"STOP"}]');
|
|
37
|
+
helpers_1.default.emitInferenceEvent = jest.fn();
|
|
38
|
+
base_wrapper_1.default.recordMetrics = jest.fn();
|
|
39
|
+
base_wrapper_1.default.setBaseSpanAttributes = jest.fn().mockImplementation((span, attrs) => {
|
|
40
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL, attrs.aiSystem);
|
|
41
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_ENDPOINT, attrs.genAIEndpoint);
|
|
42
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, attrs.model);
|
|
43
|
+
if (attrs.cost !== undefined) {
|
|
44
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_COST, attrs.cost);
|
|
45
|
+
}
|
|
46
|
+
if (attrs.serverAddress) {
|
|
47
|
+
span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, attrs.serverAddress);
|
|
48
|
+
}
|
|
49
|
+
if (attrs.serverPort !== undefined) {
|
|
50
|
+
span.setAttribute(semantic_convention_1.default.SERVER_PORT, attrs.serverPort);
|
|
51
|
+
}
|
|
52
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_SDK_VERSION, '1.9.0');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
jest.clearAllMocks();
|
|
57
|
+
});
|
|
58
|
+
describe('Generate Content Trace Consistency', () => {
|
|
59
|
+
it('should set same attributes as Python SDK', async () => {
|
|
60
|
+
const mockArgs = [
|
|
61
|
+
{
|
|
62
|
+
contents: [
|
|
63
|
+
{ role: 'user', parts: [{ text: 'What is Gemini?' }] },
|
|
64
|
+
],
|
|
65
|
+
config: {
|
|
66
|
+
temperature: 0.7,
|
|
67
|
+
maxOutputTokens: 100,
|
|
68
|
+
topP: 0.95,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
const mockResponse = {
|
|
73
|
+
response: {
|
|
74
|
+
modelVersion: 'gemini-pro',
|
|
75
|
+
text: () => "Gemini is Google's AI model",
|
|
76
|
+
candidates: [
|
|
77
|
+
{
|
|
78
|
+
content: {
|
|
79
|
+
parts: [{ text: "Gemini is Google's AI model" }],
|
|
80
|
+
role: 'model',
|
|
81
|
+
},
|
|
82
|
+
finishReason: 'STOP',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
usageMetadata: {
|
|
86
|
+
promptTokenCount: 5,
|
|
87
|
+
candidatesTokenCount: 10,
|
|
88
|
+
totalTokenCount: 15,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
await wrapper_1.default._generateContent({
|
|
93
|
+
args: mockArgs,
|
|
94
|
+
genAIEndpoint: 'google.generativeai.models.generate_content',
|
|
95
|
+
response: mockResponse,
|
|
96
|
+
span: mockSpan,
|
|
97
|
+
requestModel: 'gemini-pro',
|
|
98
|
+
});
|
|
99
|
+
// Provider name: gcp.gemini (matches OTel semconv well-known value for Google AI Studio)
|
|
100
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL, 'gcp.gemini');
|
|
101
|
+
// Request model
|
|
102
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, 'gemini-pro');
|
|
103
|
+
// Response model
|
|
104
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, 'gemini-pro');
|
|
105
|
+
// Token usage
|
|
106
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, 5);
|
|
107
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, 10);
|
|
108
|
+
// Server address + port
|
|
109
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_ADDRESS, 'generativelanguage.googleapis.com');
|
|
110
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_PORT, 443);
|
|
111
|
+
// Request params from config
|
|
112
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 0.7);
|
|
113
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 100);
|
|
114
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P, 0.95);
|
|
115
|
+
// is_stream
|
|
116
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
|
|
117
|
+
// Finish reason as array
|
|
118
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, ['STOP']);
|
|
119
|
+
// Output type
|
|
120
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, 'text');
|
|
121
|
+
});
|
|
122
|
+
it('should not set sentinel values for unset params', async () => {
|
|
123
|
+
const mockArgs = [
|
|
124
|
+
{
|
|
125
|
+
contents: 'Hello',
|
|
126
|
+
config: {},
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
const mockResponse = {
|
|
130
|
+
response: {
|
|
131
|
+
text: () => 'Hi there!',
|
|
132
|
+
candidates: [{ content: { parts: [{ text: 'Hi there!' }], role: 'model' }, finishReason: 'STOP' }],
|
|
133
|
+
usageMetadata: { promptTokenCount: 2, candidatesTokenCount: 3, totalTokenCount: 5 },
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
|
|
137
|
+
await wrapper_1.default._generateContent({
|
|
138
|
+
args: mockArgs,
|
|
139
|
+
genAIEndpoint: 'google.generativeai.models.generate_content',
|
|
140
|
+
response: mockResponse,
|
|
141
|
+
span: mockSpan,
|
|
142
|
+
requestModel: 'gemini-2.0-flash',
|
|
143
|
+
});
|
|
144
|
+
const setAttrCalls = mockSpan.setAttribute.mock.calls.map((c) => c[0]);
|
|
145
|
+
expect(setAttrCalls).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE);
|
|
146
|
+
expect(setAttrCalls).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS);
|
|
147
|
+
expect(setAttrCalls).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P);
|
|
148
|
+
expect(setAttrCalls).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_TOP_K);
|
|
149
|
+
expect(setAttrCalls).not.toContain(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES);
|
|
150
|
+
});
|
|
151
|
+
it('should emit inference event independently of captureMessageContent', async () => {
|
|
152
|
+
config_1.default.captureMessageContent = false;
|
|
153
|
+
const mockArgs = [{ contents: 'Hello', config: {} }];
|
|
154
|
+
const mockResponse = {
|
|
155
|
+
response: {
|
|
156
|
+
text: () => 'Hi!',
|
|
157
|
+
candidates: [{ content: { parts: [{ text: 'Hi!' }], role: 'model' }, finishReason: 'STOP' }],
|
|
158
|
+
usageMetadata: { promptTokenCount: 1, candidatesTokenCount: 1, totalTokenCount: 2 },
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
|
|
162
|
+
await wrapper_1.default._generateContent({
|
|
163
|
+
args: mockArgs,
|
|
164
|
+
genAIEndpoint: 'google.generativeai.models.generate_content',
|
|
165
|
+
response: mockResponse,
|
|
166
|
+
span: mockSpan,
|
|
167
|
+
requestModel: 'gemini-2.0-flash',
|
|
168
|
+
});
|
|
169
|
+
expect(helpers_1.default.emitInferenceEvent).toHaveBeenCalledTimes(1);
|
|
170
|
+
const eventAttrs = helpers_1.default.emitInferenceEvent.mock.calls[0][1];
|
|
171
|
+
expect(eventAttrs[semantic_convention_1.default.GEN_AI_INPUT_MESSAGES]).toBeUndefined();
|
|
172
|
+
expect(eventAttrs[semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES]).toBeUndefined();
|
|
173
|
+
});
|
|
174
|
+
it('should call recordMetrics with cost from Shield360Config.pricingInfo', async () => {
|
|
175
|
+
config_1.default.pricingInfo = { chat: { 'gemini-pro': { promptPrice: 0.1, completionPrice: 0.2 } } };
|
|
176
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.0025);
|
|
177
|
+
const mockArgs = [{ contents: 'test', config: {} }];
|
|
178
|
+
const mockResponse = {
|
|
179
|
+
response: {
|
|
180
|
+
modelVersion: 'gemini-pro',
|
|
181
|
+
text: () => 'response',
|
|
182
|
+
candidates: [{ content: { parts: [{ text: 'response' }], role: 'model' }, finishReason: 'STOP' }],
|
|
183
|
+
usageMetadata: { promptTokenCount: 10, candidatesTokenCount: 5, totalTokenCount: 15 },
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
await wrapper_1.default._generateContent({
|
|
187
|
+
args: mockArgs,
|
|
188
|
+
genAIEndpoint: 'google.generativeai.models.generate_content',
|
|
189
|
+
response: mockResponse,
|
|
190
|
+
span: mockSpan,
|
|
191
|
+
requestModel: 'gemini-pro',
|
|
192
|
+
});
|
|
193
|
+
expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(mockSpan, expect.objectContaining({
|
|
194
|
+
model: 'gemini-pro',
|
|
195
|
+
cost: 0.0025,
|
|
196
|
+
aiSystem: 'gcp.gemini',
|
|
197
|
+
}));
|
|
198
|
+
});
|
|
199
|
+
it('should handle function calls matching Python tool attributes', async () => {
|
|
200
|
+
const mockArgs = [{ contents: 'What is the weather?', config: {} }];
|
|
201
|
+
const mockResponse = {
|
|
202
|
+
response: {
|
|
203
|
+
text: () => '',
|
|
204
|
+
candidates: [{
|
|
205
|
+
content: {
|
|
206
|
+
parts: [{
|
|
207
|
+
functionCall: { name: 'get_weather', args: { location: 'NYC' } },
|
|
208
|
+
}],
|
|
209
|
+
role: 'model',
|
|
210
|
+
},
|
|
211
|
+
finishReason: 'STOP',
|
|
212
|
+
}],
|
|
213
|
+
usageMetadata: { promptTokenCount: 5, candidatesTokenCount: 8, totalTokenCount: 13 },
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
|
|
217
|
+
await wrapper_1.default._generateContent({
|
|
218
|
+
args: mockArgs,
|
|
219
|
+
genAIEndpoint: 'google.generativeai.models.generate_content',
|
|
220
|
+
response: mockResponse,
|
|
221
|
+
span: mockSpan,
|
|
222
|
+
requestModel: 'gemini-2.0-flash',
|
|
223
|
+
});
|
|
224
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_NAME, 'get_weather');
|
|
225
|
+
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_ARGS, '{"location":"NYC"}');
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
//# sourceMappingURL=google-ai-trace-comparison.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-ai-trace-comparison.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/google-ai-trace-comparison.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,4CAA2C;AAC3C,mEAAmD;AACnD,0DAA2C;AAC3C,4DAA4C;AAC5C,mEAA0C;AAC1C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3B,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAE7B,MAAM,UAAU,GAAG,WAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAElD,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAChE,IAAI,QAAa,CAAC;IAElB,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC7C,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAClC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC9B,QAAQ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Module) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const gpu_1 = require("../gpu");
|
|
7
|
+
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
8
|
+
// Columns match NVIDIA_SMI_FIELDS order:
|
|
9
|
+
// index, uuid, name, util.gpu, util.encoder, util.decoder, temp, fan,
|
|
10
|
+
// mem.total, mem.used, mem.free, power.draw, enforced.power.limit, power.limit
|
|
11
|
+
const NVIDIA_CSV = '0, GPU-11111111-2222-3333-4444-555555555555, NVIDIA A100-SXM4-40GB, 87, 15, 5, 65, 30, 40960, 30000, 10960, 250.50, 400.00, 400.00\n' +
|
|
12
|
+
'1, GPU-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee, NVIDIA A100-SXM4-40GB, 12, 0, 0, 40, 25, 40960, 1024, 39936, 60.25, 0, 400.00\n';
|
|
13
|
+
const ROCM_JSON = JSON.stringify({
|
|
14
|
+
card0: {
|
|
15
|
+
'GPU ID': '0x740f',
|
|
16
|
+
'Unique ID': '0x123456789abcdef',
|
|
17
|
+
'Card series': 'AMD Instinct MI210',
|
|
18
|
+
'GPU use (%)': '42',
|
|
19
|
+
'Temperature (Sensor edge) (C)': '55.0',
|
|
20
|
+
'Fan speed (%)': '35',
|
|
21
|
+
'VRAM Total Memory (B)': String(64 * 1024 * 1024 * 1024),
|
|
22
|
+
'VRAM Total Used Memory (B)': String(16 * 1024 * 1024 * 1024),
|
|
23
|
+
'Average Graphics Package Power (W)': '180.0',
|
|
24
|
+
'Max Graphics Package Power (W)': '300.0',
|
|
25
|
+
},
|
|
26
|
+
system: { 'Driver version': '6.2' },
|
|
27
|
+
});
|
|
28
|
+
function nvidiaRunner() {
|
|
29
|
+
return async (cmd, args) => {
|
|
30
|
+
if (cmd !== 'nvidia-smi')
|
|
31
|
+
throw new Error(`${cmd}: command not found`);
|
|
32
|
+
if (args[0] === '-L')
|
|
33
|
+
return 'GPU 0: NVIDIA A100\nGPU 1: NVIDIA A100\n';
|
|
34
|
+
return NVIDIA_CSV;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function amdRunner() {
|
|
38
|
+
return async (cmd) => {
|
|
39
|
+
if (cmd !== 'rocm-smi')
|
|
40
|
+
throw new Error(`${cmd}: command not found`);
|
|
41
|
+
return ROCM_JSON;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const noGpuRunner = async (cmd) => {
|
|
45
|
+
throw new Error(`${cmd}: command not found`);
|
|
46
|
+
};
|
|
47
|
+
function makeFakeMeter() {
|
|
48
|
+
const gauges = [];
|
|
49
|
+
const observations = [];
|
|
50
|
+
let callback = null;
|
|
51
|
+
const meter = {
|
|
52
|
+
createObservableGauge: (name) => {
|
|
53
|
+
const token = { name };
|
|
54
|
+
gauges.push({ name, token });
|
|
55
|
+
return token;
|
|
56
|
+
},
|
|
57
|
+
addBatchObservableCallback: (cb) => {
|
|
58
|
+
callback = cb;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const runCallback = async () => {
|
|
62
|
+
if (!callback)
|
|
63
|
+
throw new Error('no callback registered');
|
|
64
|
+
await callback({
|
|
65
|
+
observe: (gauge, value, attributes) => observations.push({ gauge, value, attributes }),
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return { meter: meter, gauges, observations, runCallback };
|
|
69
|
+
}
|
|
70
|
+
describe('GpuMetricsCollector', () => {
|
|
71
|
+
it('detects nvidia GPUs', async () => {
|
|
72
|
+
expect(await new gpu_1.GpuMetricsCollector(nvidiaRunner()).detectGpuType()).toBe('nvidia');
|
|
73
|
+
});
|
|
74
|
+
it('detects amd GPUs when nvidia-smi is missing', async () => {
|
|
75
|
+
expect(await new gpu_1.GpuMetricsCollector(amdRunner()).detectGpuType()).toBe('amd');
|
|
76
|
+
});
|
|
77
|
+
it('returns null when no supported GPU tooling exists', async () => {
|
|
78
|
+
expect(await new gpu_1.GpuMetricsCollector(noGpuRunner).detectGpuType()).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
it('setup registers all 11 gauges with Python-matching metric names', async () => {
|
|
81
|
+
const { meter, gauges } = makeFakeMeter();
|
|
82
|
+
const collector = new gpu_1.GpuMetricsCollector(nvidiaRunner());
|
|
83
|
+
const gpuType = await collector.setup({
|
|
84
|
+
meter,
|
|
85
|
+
environment: 'staging',
|
|
86
|
+
applicationName: 'my-app',
|
|
87
|
+
});
|
|
88
|
+
expect(gpuType).toBe('nvidia');
|
|
89
|
+
expect(gauges.map((g) => g.name)).toEqual([
|
|
90
|
+
'gpu.utilization',
|
|
91
|
+
'gpu.enc.utilization',
|
|
92
|
+
'gpu.dec.utilization',
|
|
93
|
+
'gpu.temperature',
|
|
94
|
+
'gpu.fan_speed',
|
|
95
|
+
'gpu.memory.available',
|
|
96
|
+
'gpu.memory.total',
|
|
97
|
+
'gpu.memory.used',
|
|
98
|
+
'gpu.memory.free',
|
|
99
|
+
'gpu.power.draw',
|
|
100
|
+
'gpu.power.limit',
|
|
101
|
+
]);
|
|
102
|
+
});
|
|
103
|
+
it('setup returns null and registers nothing without a GPU', async () => {
|
|
104
|
+
const { meter, gauges } = makeFakeMeter();
|
|
105
|
+
const gpuType = await new gpu_1.GpuMetricsCollector(noGpuRunner).setup({
|
|
106
|
+
meter,
|
|
107
|
+
environment: 'staging',
|
|
108
|
+
applicationName: 'my-app',
|
|
109
|
+
});
|
|
110
|
+
expect(gpuType).toBeNull();
|
|
111
|
+
expect(gauges).toHaveLength(0);
|
|
112
|
+
});
|
|
113
|
+
it('observes nvidia stats per GPU with Python-matching attributes', async () => {
|
|
114
|
+
const { meter, observations, runCallback } = makeFakeMeter();
|
|
115
|
+
const collector = new gpu_1.GpuMetricsCollector(nvidiaRunner());
|
|
116
|
+
await collector.setup({ meter, environment: 'staging', applicationName: 'my-app' });
|
|
117
|
+
await runCallback();
|
|
118
|
+
// 2 GPUs x 11 metrics
|
|
119
|
+
expect(observations).toHaveLength(22);
|
|
120
|
+
const gpu0 = observations.filter((o) => o.attributes[semantic_convention_1.default.GPU_INDEX] === '0');
|
|
121
|
+
expect(gpu0).toHaveLength(11);
|
|
122
|
+
expect(gpu0[0].attributes).toEqual({
|
|
123
|
+
'telemetry.sdk.name': 'shield360',
|
|
124
|
+
'service.name': 'my-app',
|
|
125
|
+
[semantic_convention_1.default.ATTR_DEPLOYMENT_ENVIRONMENT]: 'staging',
|
|
126
|
+
[semantic_convention_1.default.GPU_INDEX]: '0',
|
|
127
|
+
[semantic_convention_1.default.GPU_UUID]: 'GPU-11111111-2222-3333-4444-555555555555',
|
|
128
|
+
[semantic_convention_1.default.GPU_NAME]: 'NVIDIA A100-SXM4-40GB',
|
|
129
|
+
});
|
|
130
|
+
const valueOf = (metric, index) => observations.find((o) => o.gauge.name === metric &&
|
|
131
|
+
o.attributes[semantic_convention_1.default.GPU_INDEX] === index)?.value;
|
|
132
|
+
expect(valueOf('gpu.utilization', '0')).toBe(87);
|
|
133
|
+
expect(valueOf('gpu.enc.utilization', '0')).toBe(15);
|
|
134
|
+
expect(valueOf('gpu.dec.utilization', '0')).toBe(5);
|
|
135
|
+
expect(valueOf('gpu.temperature', '0')).toBe(65);
|
|
136
|
+
expect(valueOf('gpu.fan_speed', '0')).toBe(30);
|
|
137
|
+
expect(valueOf('gpu.memory.total', '0')).toBe(40960);
|
|
138
|
+
expect(valueOf('gpu.memory.used', '0')).toBe(30000);
|
|
139
|
+
expect(valueOf('gpu.memory.free', '0')).toBe(10960);
|
|
140
|
+
expect(valueOf('gpu.memory.available', '0')).toBe(10960);
|
|
141
|
+
expect(valueOf('gpu.power.draw', '0')).toBe(250.5);
|
|
142
|
+
expect(valueOf('gpu.power.limit', '0')).toBe(400);
|
|
143
|
+
expect(valueOf('gpu.utilization', '1')).toBe(12);
|
|
144
|
+
// GPU 1: enforced.power.limit is 0 / N/A → fall back to power.limit
|
|
145
|
+
expect(valueOf('gpu.power.limit', '1')).toBe(400);
|
|
146
|
+
expect(valueOf('gpu.enc.utilization', '1')).toBe(0);
|
|
147
|
+
expect(valueOf('gpu.dec.utilization', '1')).toBe(0);
|
|
148
|
+
});
|
|
149
|
+
it('observes amd stats from rocm-smi JSON', async () => {
|
|
150
|
+
const { meter, observations, runCallback } = makeFakeMeter();
|
|
151
|
+
const collector = new gpu_1.GpuMetricsCollector(amdRunner());
|
|
152
|
+
await collector.setup({ meter, environment: 'default', applicationName: 'default' });
|
|
153
|
+
await runCallback();
|
|
154
|
+
expect(observations).toHaveLength(11);
|
|
155
|
+
const attrs = observations[0].attributes;
|
|
156
|
+
expect(attrs[semantic_convention_1.default.GPU_INDEX]).toBe('0');
|
|
157
|
+
expect(attrs[semantic_convention_1.default.GPU_NAME]).toBe('AMD Instinct MI210');
|
|
158
|
+
expect(attrs[semantic_convention_1.default.GPU_UUID]).toBe('0x123456789abcdef');
|
|
159
|
+
const valueOf = (metric) => observations.find((o) => o.gauge.name === metric)?.value;
|
|
160
|
+
expect(valueOf('gpu.utilization')).toBe(42);
|
|
161
|
+
expect(valueOf('gpu.enc.utilization')).toBe(0);
|
|
162
|
+
expect(valueOf('gpu.dec.utilization')).toBe(0);
|
|
163
|
+
expect(valueOf('gpu.temperature')).toBe(55);
|
|
164
|
+
expect(valueOf('gpu.fan_speed')).toBe(35);
|
|
165
|
+
expect(valueOf('gpu.memory.total')).toBe(64 * 1024);
|
|
166
|
+
expect(valueOf('gpu.memory.used')).toBe(16 * 1024);
|
|
167
|
+
expect(valueOf('gpu.memory.free')).toBe(48 * 1024);
|
|
168
|
+
// Python AMD memory_available == total (not free)
|
|
169
|
+
expect(valueOf('gpu.memory.available')).toBe(64 * 1024);
|
|
170
|
+
expect(valueOf('gpu.power.draw')).toBe(180);
|
|
171
|
+
expect(valueOf('gpu.power.limit')).toBe(300);
|
|
172
|
+
});
|
|
173
|
+
it('swallows collection errors without throwing from the callback', async () => {
|
|
174
|
+
let detect = true;
|
|
175
|
+
const flakyRunner = async (cmd, args) => {
|
|
176
|
+
if (cmd !== 'nvidia-smi')
|
|
177
|
+
throw new Error('not found');
|
|
178
|
+
if (args[0] === '-L' && detect)
|
|
179
|
+
return 'GPU 0: NVIDIA A100';
|
|
180
|
+
throw new Error('nvidia-smi crashed');
|
|
181
|
+
};
|
|
182
|
+
const { meter, observations, runCallback } = makeFakeMeter();
|
|
183
|
+
const collector = new gpu_1.GpuMetricsCollector(flakyRunner);
|
|
184
|
+
await collector.setup({ meter, environment: 'default', applicationName: 'default' });
|
|
185
|
+
detect = false;
|
|
186
|
+
await expect(runCallback()).resolves.toBeUndefined();
|
|
187
|
+
expect(observations).toHaveLength(0);
|
|
188
|
+
});
|
|
189
|
+
it('swallows invalid AMD JSON without throwing from the callback', async () => {
|
|
190
|
+
const badJsonRunner = async (cmd, args) => {
|
|
191
|
+
if (cmd === 'nvidia-smi')
|
|
192
|
+
throw new Error('not found');
|
|
193
|
+
if (cmd !== 'rocm-smi')
|
|
194
|
+
throw new Error('not found');
|
|
195
|
+
if (args.includes('--showid') && args.length === 2)
|
|
196
|
+
return '{}';
|
|
197
|
+
return 'not-json{';
|
|
198
|
+
};
|
|
199
|
+
const { meter, observations, runCallback } = makeFakeMeter();
|
|
200
|
+
const collector = new gpu_1.GpuMetricsCollector(badJsonRunner);
|
|
201
|
+
await collector.setup({ meter, environment: 'default', applicationName: 'default' });
|
|
202
|
+
await expect(runCallback()).resolves.toBeUndefined();
|
|
203
|
+
expect(observations).toHaveLength(0);
|
|
204
|
+
});
|
|
205
|
+
it('parses malformed numeric fields as 0', async () => {
|
|
206
|
+
const badCsvRunner = async (cmd, args) => {
|
|
207
|
+
if (cmd !== 'nvidia-smi')
|
|
208
|
+
throw new Error('not found');
|
|
209
|
+
if (args[0] === '-L')
|
|
210
|
+
return 'GPU 0: NVIDIA A100';
|
|
211
|
+
return '0, GPU-uuid, NVIDIA A100, [N/A], [N/A], [N/A], 65, [N/A], 40960, 30000, 10960, [N/A], [N/A], 400.00\n';
|
|
212
|
+
};
|
|
213
|
+
const collector = new gpu_1.GpuMetricsCollector(badCsvRunner);
|
|
214
|
+
const { meter, runCallback, observations } = makeFakeMeter();
|
|
215
|
+
await collector.setup({ meter, environment: 'default', applicationName: 'default' });
|
|
216
|
+
await runCallback();
|
|
217
|
+
const valueOf = (metric) => observations.find((o) => o.gauge.name === metric)?.value;
|
|
218
|
+
expect(valueOf('gpu.utilization')).toBe(0);
|
|
219
|
+
expect(valueOf('gpu.enc.utilization')).toBe(0);
|
|
220
|
+
expect(valueOf('gpu.dec.utilization')).toBe(0);
|
|
221
|
+
expect(valueOf('gpu.power.draw')).toBe(0);
|
|
222
|
+
// enforced N/A → fall back to power.limit
|
|
223
|
+
expect(valueOf('gpu.power.limit')).toBe(400);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
describe('GpuStats typing', () => {
|
|
227
|
+
it('exposes all metric fields', () => {
|
|
228
|
+
const stats = {
|
|
229
|
+
index: '0',
|
|
230
|
+
uuid: 'u',
|
|
231
|
+
name: 'n',
|
|
232
|
+
utilization: 0,
|
|
233
|
+
utilization_enc: 0,
|
|
234
|
+
utilization_dec: 0,
|
|
235
|
+
temperature: 0,
|
|
236
|
+
fan_speed: 0,
|
|
237
|
+
memory_available: 0,
|
|
238
|
+
memory_total: 0,
|
|
239
|
+
memory_used: 0,
|
|
240
|
+
memory_free: 0,
|
|
241
|
+
power_draw: 0,
|
|
242
|
+
power_limit: 0,
|
|
243
|
+
};
|
|
244
|
+
expect(Object.keys(stats)).toHaveLength(14);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=gpu-collector.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-collector.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/gpu-collector.test.ts"],"names":[],"mappings":";;;;;AAAA,gCAAsE;AACtE,oFAA2D;AAE3D,yCAAyC;AACzC,sEAAsE;AACtE,+EAA+E;AAC/E,MAAM,UAAU,GACd,sIAAsI;IACtI,8HAA8H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B,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,0CAA0C;QAC1C,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,KAAK,GAAa;YACtB,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,CAAC;YAClB,eAAe,EAAE,CAAC;YAClB,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,CAAC;YACZ,gBAAgB,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC;SACf,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Language Trace Comparison Tests for the DigitalOcean Gradient Integration
|
|
3
|
+
*
|
|
4
|
+
* These verify that the TypeScript Gradient instrumentation emits the same span
|
|
5
|
+
* attributes / events as the Python SDK reference
|
|
6
|
+
* (sdk/python/src/shield360/instrumentation/gradient). Gradient is OpenAI-shaped:
|
|
7
|
+
* responses carry a `model` field, requests support seed / frequency_penalty /
|
|
8
|
+
* presence_penalty, and streaming usage arrives on the final chunk as `usage`.
|
|
9
|
+
* The provider name is `digitalocean` and chat is served from inference.do-ai.run.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|