diff --git a/Dockerfile b/Dockerfile index 1dcc6c41..678c1592 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,6 +45,7 @@ COPY --from=builder /app/public ./public COPY --from=builder /app/scripts ./scripts COPY --from=builder /app/node_modules ./node_modules COPY ./entrypoint.sh /app/entrypoint.sh +COPY ./proto ./proto RUN chmod +x /app/entrypoint.sh diff --git a/README.md b/README.md index 78cd2c12..aefff080 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,73 @@ -# [Langtrace](https://www.langtrace.ai) - -Open Source Observability for LLM applications - -## 🌐 Open Source & Open Telemetry(OTEL) Observability for LLM applications - -![Static Badge](https://img.shields.io/badge/License-AGPL--3.0-blue) -[![NPM Typescript SDK](https://img.shields.io/npm/v/%40langtrase%2Ftypescript-sdk?style=flat&logo=npm&label=%40langtrase%2Ftypescript-sdk&color=green&link=https%3A%2F%2Fgithub.com%2FScale3-Labs%2Flangtrace-typescript-sdk)](https://github.com/Scale3-Labs/langtrace-typescript-sdk) -[![PyPI Python SDK](https://img.shields.io/pypi/v/langtrace-python-sdk?style=flat&logo=python&label=langtrace-python-sdk&color=green&link=https%3A%2F%2Fgithub.com%2FScale3-Labs%2Flangtrace-python-sdk)](https://github.com/Scale3-Labs/langtrace-python-sdk) -[![Downloads](https://static.pepy.tech/badge/langtrace-python-sdk/month)](https://pepy.tech/project/langtrace-python-sdk) -[![NPM Trace Attributes](https://img.shields.io/npm/v/%40langtrase%2Ftrace-attributes?style=flat&logo=npm&label=%40langtrase%2Ftrace-attributes&color=green&link=https%3A%2F%2Fgithub.com%2FScale3-Labs%2Flangtrace-trace-attributes)](https://github.com/Scale3-Labs/langtrace-trace-attributes) -[![PyPI Trace Attributes](https://img.shields.io/pypi/v/trace-attributes?style=flat&logo=python&label=trace-attributes&color=green&link=https%3A%2F%2Fgithub.com%2FScale3-Labs%2Flangtrace-trace-attributes)](https://github.com/Scale3-Labs/langtrace-trace-attributes) -![Static Badge](https://img.shields.io/badge/Development_status-Active-green) -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/8dNq1c?referralCode=MA2S9H) +
+

+ Langtrace +
+ Langtrace +

+

Open Source Observability for LLM Applications

+ + [![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE) + [![Development Status](https://img.shields.io/badge/Status-Active-success?style=flat-square)](https://github.com/Scale3-Labs/langtrace) + [![Pull Requests](https://img.shields.io/github/issues-pr/Scale3-Labs/langtrace?style=flat-square)](https://github.com/Scale3-Labs/langtrace/pulls) + [![NPM SDK](https://img.shields.io/npm/v/%40langtrase%2Ftypescript-sdk?style=flat-square&logo=npm&label=typescript-sdk&color=green)](https://github.com/Scale3-Labs/langtrace-typescript-sdk) + [![NPM Downloads](https://img.shields.io/npm/dm/%40langtrase%2Ftypescript-sdk?style=flat-square&logo=npm)](https://www.npmjs.com/package/@langtrase/typescript-sdk) + [![PyPI SDK](https://img.shields.io/pypi/v/langtrace-python-sdk?style=flat-square&logo=python&label=python-sdk&color=green)](https://github.com/Scale3-Labs/langtrace-python-sdk) + [![Downloads](https://static.pepy.tech/badge/langtrace-python-sdk/month)](https://pepy.tech/project/langtrace-python-sdk) + [![Deploy](https://railway.app/button.svg)](https://railway.app/template/8dNq1c?referralCode=MA2S9H) +
--- +## πŸ“š Table of Contents +- [✨ Features](#-features) +- [πŸš€ Quick Start](#-quick-start) +- [πŸ”— Integrations](#-supported-integrations) +- [🌐 Getting Started](#-getting-started) +- [🏠 Self Hosting](#-langtrace-self-hosted) +- [πŸ“ Architecture](#-langtrace-system-architecture) +- [🀝 Contributing](#-contributions) +- [πŸ”’ Security](#-security) +- [❓ FAQ](#-frequently-asked-questions) +- [πŸ‘₯ Contributors](#-contributors) +- [πŸ“œ License](#-license) + Langtrace is an open source observability software which lets you capture, debug and analyze traces and metrics from all your applications that leverages LLM APIs, Vector Databases and LLM based Frameworks. ![image](/public/langtrace-tracing-ss.png) +## ✨ Features + +- πŸ“Š **Open Telemetry Support**: Built on OTEL standards for comprehensive tracing +- πŸ”„ **Real-time Monitoring**: Track LLM API calls, vector operations, and framework usage +- 🎯 **Performance Insights**: Analyze latency, costs, and usage patterns +- πŸ” **Debug Tools**: Trace and debug your LLM application workflows +- πŸ“ˆ **Analytics**: Get detailed metrics and visualizations +- 🏠 **Self-hosting Option**: Deploy on your own infrastructure + +## πŸš€ Quick Start + +```bash +# For TypeScript/JavaScript +npm i @langtrase/typescript-sdk + +# For Python +pip install langtrace-python-sdk +``` + +Initialize in your code: +```typescript +// TypeScript +import * as Langtrace from '@langtrase/typescript-sdk' +Langtrace.init({ api_key: '' }) // Get your API key at langtrace.ai +``` +```python +# Python +from langtrace_python_sdk import langtrace +langtrace.init(api_key='') # Get your API key at langtrace.ai +``` + +For detailed setup instructions, see [Getting Started](#-getting-started). + ## πŸ“Š Open Telemetry Support The traces generated by Langtrace adhere to [Open Telemetry Standards(OTEL)](https://opentelemetry.io/docs/concepts/signals/traces/). We are developing [semantic conventions](https://opentelemetry.io/docs/concepts/semantic-conventions/) for the traces generated by this project. You can checkout the current definitions in [this repository](https://github.com/Scale3-Labs/langtrace-trace-attributes/tree/main/schemas). Note: This is an ongoing development and we encourage you to get involved and welcome your feedback. @@ -138,36 +187,45 @@ If you prefer to disable telemetry, you can do so by setting TELEMETRY_ENABLED=f --- -## πŸ”— Supported integrations - -Langtrace automatically captures traces from the following vendors: - -| Vendor | Type | Typescript SDK | Python SDK | -| ------------ | --------------- | ------------------ | ------------------------------- | -| OpenAI | LLM | :white_check_mark: | :white_check_mark: | -| Anthropic | LLM | :white_check_mark: | :white_check_mark: | -| Azure OpenAI | LLM | :white_check_mark: | :white_check_mark: | -| Cohere | LLM | :white_check_mark: | :white_check_mark: | -| xAI | LLM | :white_check_mark: | :white_check_mark: | -| Groq | LLM | :white_check_mark: | :white_check_mark: | -| Perplexity | LLM | :white_check_mark: | :white_check_mark: | -| Gemini | LLM | :white_check_mark: | :white_check_mark: | -| AWS Bedrock | LLM | :white_check_mark: | :x: | -| Mistral | LLM | :x: | :white_check_mark: | -| Langchain | Framework | :x: | :white_check_mark: | -| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: | -| Langgraph | Framework | :x: | :white_check_mark: | -| LiteLLM | Framework | :x: | :white_check_mark: | -| DSPy | Framework | :x: | :white_check_mark: | -| CrewAI | Framework | :x: | :white_check_mark: | -| Ollama | Framework | :x: | :white_check_mark: | -| VertexAI | Framework | :white_check_mark: | :white_check_mark: | -| Vercel AI | Framework | :white_check_mark: | :x: | -| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: | -| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: | -| QDrant | Vector Database | :white_check_mark: | :white_check_mark: | -| Weaviate | Vector Database | :white_check_mark: | :white_check_mark: | -| PGVector | Vector Database | :white_check_mark: | :white_check_mark: (SQLAlchemy) | +## πŸ”— Supported Integrations + +Langtrace automatically captures traces from the following vendors and frameworks: + +### LLM Providers +| Provider | TypeScript SDK | Python SDK | +|----------|:-------------:|:----------:| +| OpenAI | βœ… | βœ… | +| Anthropic | βœ… | βœ… | +| Azure OpenAI | βœ… | βœ… | +| Cohere | βœ… | βœ… | +| xAI | βœ… | βœ… | +| Groq | βœ… | βœ… | +| Perplexity | βœ… | βœ… | +| Gemini | βœ… | βœ… | +| AWS Bedrock | βœ… | ❌ | +| Mistral | ❌ | βœ… | + +### LLM Frameworks +| Framework | TypeScript SDK | Python SDK | +|-----------|:-------------:|:----------:| +| Langchain | ❌ | βœ… | +| LlamaIndex | βœ… | βœ… | +| Langgraph | ❌ | βœ… | +| LiteLLM | ❌ | βœ… | +| DSPy | ❌ | βœ… | +| CrewAI | ❌ | βœ… | +| Ollama | ❌ | βœ… | +| VertexAI | βœ… | βœ… | +| Vercel AI | βœ… | ❌ | + +### Vector Databases +| Database | TypeScript SDK | Python SDK | +|----------|:-------------:|:----------:| +| Pinecone | βœ… | βœ… | +| ChromaDB | βœ… | βœ… | +| QDrant | βœ… | βœ… | +| Weaviate | βœ… | βœ… | +| PGVector | βœ… | βœ… (SQLAlchemy) | --- @@ -207,6 +265,36 @@ To report security vulnerabilities, email us at . You c - Langtrace application(this repository) is [licensed](https://github.com/Scale3-Labs/langtrace/blob/development/LICENSE) under the AGPL 3.0 License. You can read about this license [here](https://www.gnu.org/licenses/agpl-3.0.en.html). - Langtrace SDKs are licensed under the Apache 2.0 License. You can read about this license [here](https://www.apache.org/licenses/LICENSE-2.0). +## πŸ‘₯ Contributors + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
karthikscale3
karthikscale3
dylanzuber-scale3
dylanzuber-scale3
darshit-s3
darshit-s3
rohit-kadhe
rohit-kadhe
yemiadej
yemiadej
alizenhom
alizenhom
obinnascale3
obinnascale3
Cruppelt
Cruppelt
Dnaynu
Dnaynu
jatin9823
jatin9823
MayuriS24
MayuriS24
NishantRana07
NishantRana07
obinnaokafor
obinnaokafor
heysagnik
heysagnik
dabiras3
dabiras3
+
+ --- ## ❓Frequently Asked Questions diff --git a/app/(protected)/project/[project_id]/annotations/annotations.tsx b/app/(protected)/project/[project_id]/annotations/annotations.tsx index 78c9d47e..4a0108fe 100644 --- a/app/(protected)/project/[project_id]/annotations/annotations.tsx +++ b/app/(protected)/project/[project_id]/annotations/annotations.tsx @@ -77,10 +77,21 @@ export default function Annotations({ email }: { email: string }) { type: "event", }, { - key: "status_code", - operation: "EQUALS", - value: "STATUS_CODE_OK", - type: "property", + operation: "OR", + filters: [ + { + key: "status_code", + operation: "EQUALS", + value: "STATUS_CODE_OK", + type: "property", + }, + { + key: "status_code", + operation: "EQUALS", + value: "1", + type: "property", + }, + ], }, ], }, diff --git a/app/api/trace/route.ts b/app/api/trace/route.ts index 6a451f9e..b0af6b28 100644 --- a/app/api/trace/route.ts +++ b/app/api/trace/route.ts @@ -59,10 +59,17 @@ export async function POST(req: NextRequest) { { message: "Traces added successfully" }, { status: 200 } ); - } catch (error) { + } catch (err: unknown) { + const error = err as Error; + return NextResponse.json( { - error: "Something went wrong while ingesting traces", + name: error?.name || 'UnknownError', + message: error?.message || 'Something went wrong while ingesting traces', + stack: error?.stack, + fullError: error instanceof Error + ? JSON.stringify(error, Object.getOwnPropertyNames(error)) + : JSON.stringify(error) }, { status: 404 } ); diff --git a/components/annotations/chart-tabs.tsx b/components/annotations/chart-tabs.tsx index 66f28607..05003846 100644 --- a/components/annotations/chart-tabs.tsx +++ b/components/annotations/chart-tabs.tsx @@ -26,29 +26,29 @@ export function ChartTabs({ queryFn: async () => { const filters = { filters: [ + { + key: "name", + operation: "EQUALS", + value: "gen_ai.content.completion", + type: "event", + }, { operation: "OR", filters: [ { - key: "llm.prompts", - operation: "NOT_EQUALS", - value: "", - type: "attribute", + key: "status_code", + operation: "EQUALS", + value: "STATUS_CODE_OK", + type: "property", }, { - key: "name", + key: "status_code", operation: "EQUALS", - value: "gen_ai.content.completion", - type: "event", + value: "1", + type: "property", }, ], }, - { - key: "status_code", - operation: "EQUALS", - value: "OK", - type: "property", - }, ], operation: "AND", }; diff --git a/components/shared/vendor-metadata.tsx b/components/shared/vendor-metadata.tsx index 3656e20e..45fef035 100644 --- a/components/shared/vendor-metadata.tsx +++ b/components/shared/vendor-metadata.tsx @@ -150,6 +150,10 @@ export function vendorColor(vendor: string) { return "bg-green-200"; } + if (vendor.includes("guardrails")) { + return "bg-green-200"; + } + return "bg-gray-800"; } @@ -497,8 +501,24 @@ export function VendorLogo({ MongoDB Logo + ); + } + + if (vendor.includes("guardrails")) { + const color = vendorColor("guardrails"); + return ( + Guardrails Logo = ({ color = "bg-blue-500"; else if (span.name.includes("mongodb") || serviceName.includes("mongodb")) color = "bg-green-500"; + else if (span.name.includes("guardrails") || serviceName.includes("guardrails")) + color = "bg-green-500"; const fillColor = color.replace("bg-", "fill-"); const vendor = getVendorFromSpan(span as any); diff --git a/lib/utils.ts b/lib/utils.ts index 750792a8..94677d5b 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -833,6 +833,8 @@ export function getVendorFromSpan(span: Span): string { vendor = "litellm"; } else if (span.name.includes("mongodb") || serviceName.includes("mongodb")) { vendor = "mongodb"; + } else if (span.name.includes("guard") || serviceName.includes("guard")) { + vendor = "guardrails"; } return vendor; } diff --git a/public/guardrails.png b/public/guardrails.png new file mode 100644 index 00000000..1d54dd44 Binary files /dev/null and b/public/guardrails.png differ