-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathvendor-metadata.tsx
175 lines (152 loc) · 3.81 KB
/
vendor-metadata.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import { StackIcon } from "@radix-ui/react-icons";
import Image from "next/image";
interface Span {
name: string;
start_time: string;
end_time: string;
attributes: any;
children?: Span[];
}
export function vendorBadgeColor(vendor: string) {
if (!vendor) {
return "bg-gray-500";
}
if (vendor.includes("openai")) {
return "bg-blue-500";
}
if (vendor.includes("anthropic")) {
return "bg-yellow-500";
}
if (vendor.includes("pinecone")) {
return "bg-green-500";
}
if (vendor.includes("chroma")) {
return "bg-cyan-500";
}
if (vendor.includes("langchain")) {
return "bg-purple-500";
}
if (vendor.includes("llamaindex")) {
return "bg-indigo-500";
}
return "bg-gray-500";
}
export function vendorColor(vendor: string) {
if (!vendor) {
return "bg-gray-200";
}
if (vendor.includes("openai")) {
return "bg-blue-200";
}
if (vendor.includes("anthropic")) {
return "bg-yellow-200";
}
if (vendor.includes("pinecone")) {
return "bg-green-200";
}
if (vendor.includes("chroma")) {
return "bg-cyan-200";
}
if (vendor.includes("langchain")) {
return "bg-purple-200";
}
if (vendor.includes("llamaindex")) {
return "bg-indigo-200";
}
return "bg-gray-800";
}
export function serviceTypeColor(serviceType: string) {
if (serviceType === "llm") {
return "bg-purple-500";
} else if (serviceType === "framework") {
return "bg-blue-500";
} else if (serviceType === "vectordb") {
return "bg-green-500";
}
return "bg-gray-500";
}
export function VendorLogo({ span }: { span: Span }) {
const attributes = span.attributes ? JSON.parse(span.attributes) : {};
let serviceName = "";
if (attributes["langtrace.service.name"]) {
serviceName = attributes["langtrace.service.name"].toLowerCase();
}
if (span.name.includes("openai") || serviceName.includes("openai")) {
const color = vendorColor("openai");
return (
<Image
alt="OpenAI Logo"
src="/openai.svg"
width={20}
height={20}
className={`${color} p-[3px] rounded-sm`}
/>
);
}
if (span.name.includes("anthropic") || serviceName.includes("anthropic")) {
const color = vendorColor("anthropic");
return (
<Image
alt="Anthropic Logo"
src="/anthropic.png"
width={30}
height={30}
className="p-[3px] rounded-md"
/>
);
}
if (span.name.includes("pinecone") || serviceName.includes("pinecone")) {
const color = vendorColor("pinecone");
return (
<Image
alt="Pinecone Logo"
src="/pinecone.png"
width={20}
height={20}
className={`${color} p-[3px] rounded-sm`}
/>
);
}
if (span.name.includes("chromadb") || serviceName.includes("chromadb")) {
const color = vendorColor("chromadb");
return (
<Image
alt="ChromaDB Logo"
src="/chroma.png"
width={25}
height={25}
className={`${color} p-[3px] rounded-sm`}
/>
);
}
if (span.name.includes("langchain") || serviceName.includes("langchain")) {
const color = vendorColor("langchain");
return (
<Image
alt="Langchain Logo"
src="/langchain.svg"
width={30}
height={30}
className={`${color} p-[3px] rounded-sm`}
/>
);
}
if (span.name.includes("llamaindex") || serviceName.includes("llamaindex")) {
const color = vendorColor("llamaindex");
return (
<Image
alt="LlamaIndex Logo"
src="/llamaindex.svg"
width={60}
height={80}
className={`${color} p-[3px] rounded-sm`}
/>
);
}
const color = vendorColor("langtrace");
return (
<div className="flex items-center bg-muted p-2 rounded-sm">
<StackIcon className={"w-4 h-4 text-primary rounded-sm"} />
</div>
);
}