Skip to content
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

DSPy support #144

Merged
merged 44 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b178105
Pagination bug
karthikscale3 Apr 4, 2024
af47e53
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 4, 2024
cc6ab77
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 4, 2024
677b1aa
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 4, 2024
f996899
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 4, 2024
0e963e2
Bug fix
karthikscale3 Apr 5, 2024
f3a8a23
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 5, 2024
3c353a5
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 5, 2024
94f0fb1
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 7, 2024
f22f397
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 8, 2024
5023d1f
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 9, 2024
4178d5c
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 11, 2024
4fe4108
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 13, 2024
784f09c
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 14, 2024
42f1128
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 19, 2024
0c8e92b
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 24, 2024
28227d9
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 28, 2024
0cec8be
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Apr 28, 2024
eae354d
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 7, 2024
7723147
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 7, 2024
31bfd5f
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 7, 2024
1b9c986
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 9, 2024
31f50e6
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 9, 2024
4e30354
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 9, 2024
9cbb929
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 9, 2024
bee3df8
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 9, 2024
186f82b
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 13, 2024
2099f1d
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 13, 2024
047f9b6
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 13, 2024
194c65e
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 17, 2024
63eb067
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 20, 2024
3a44486
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 21, 2024
9ad8c44
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 21, 2024
5605411
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 21, 2024
eb53696
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 21, 2024
1d29604
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 22, 2024
020a3a9
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 22, 2024
b9b73db
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 May 22, 2024
a41a9f0
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Jun 7, 2024
6111ef5
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Jun 7, 2024
77d1bd5
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
karthikscale3 Jun 13, 2024
3aa0528
Bugfixes
karthikscale3 Jun 16, 2024
78ea8e2
DSPy support
karthikscale3 Jun 17, 2024
b985d37
Update README
karthikscale3 Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Langtrace automatically captures traces from the following vendors:
| Groq | LLM | :x: | :white_check_mark: |
| Langchain | Framework | :x: | :white_check_mark: |
| LlamaIndex | Framework | :white_check_mark: | :white_check_mark: |
| DSPy | Framework | :x: | :white_check_mark: |
| Pinecone | Vector Database | :white_check_mark: | :white_check_mark: |
| ChromaDB | Vector Database | :white_check_mark: | :white_check_mark: |
| QDrant | Vector Database | :x: | :white_check_mark: |
Expand Down
77 changes: 42 additions & 35 deletions components/project/traces/trace-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
convertTracesToHierarchy,
correctTimestampFormat,
} from "@/lib/trace_utils";
import { calculatePriceFromUsage, formatDateTime } from "@/lib/utils";
import { calculatePriceFromUsage, cn, formatDateTime } from "@/lib/utils";
import { ChevronDown, ChevronRight } from "lucide-react";
import { useState } from "react";
import { JsonView, allExpanded, defaultStyles } from "react-json-view-lite";
Expand Down Expand Up @@ -104,11 +104,10 @@ export const TraceRow = ({
return (
<div className="flex flex-col gap-3">
<div
className={
importTrace
? "grid grid-cols-12 items-center gap-6 cursor-pointer"
: "grid grid-cols-11 items-center gap-6 cursor-pointer"
}
className={cn(
importTrace ? "grid-cols-12" : "grid-cols-11",
"grid items-center gap-6 cursor-pointer"
)}
onClick={() => setCollapsed(!collapsed)}
>
<div className="flex flex-row items-center gap-2">
Expand Down Expand Up @@ -149,14 +148,22 @@ export const TraceRow = ({
</p>
</div>
<p className="text-xs font-semibold">{model}</p>
<HoverCell
values={prompts?.length > 0 ? JSON.parse(prompts[0]) : []}
className="flex items-center max-w-fit text-xs h-10 truncate overflow-y-scroll font-semibold col-span-2"
/>
<HoverCell
values={responses?.length > 0 ? JSON.parse(responses[0]) : []}
className="flex items-center max-w-fit text-xs h-10 truncate overflow-y-scroll font-semibold col-span-2"
/>
{prompts?.length > 0 ? (
<HoverCell
values={JSON.parse(prompts[0])}
className="flex items-center max-w-fit text-xs h-10 truncate overflow-y-scroll font-semibold col-span-2"
/>
) : (
<p className="text-xs font-semibold col-span-2"></p>
)}
{responses?.length > 0 ? (
<HoverCell
values={JSON.parse(responses[0])}
className="flex items-center max-w-fit text-xs h-10 truncate overflow-y-scroll font-semibold col-span-2"
/>
) : (
<p className="text-xs font-semibold col-span-2"></p>
)}
<p className="text-xs font-semibold">{userId}</p>
<p className="text-xs">
{tokenCounts?.input_tokens || tokenCounts?.prompt_tokens}
Expand Down Expand Up @@ -199,6 +206,25 @@ export const TraceRow = ({
)}
</Button>
)}
<Button
disabled={prompts.length === 0 || responses.length === 0}
onClick={() => setSelectedTab("llm")}
variant={"ghost"}
className="flex flex-col justify-between pb-0"
>
<p
className={
selectedTab === "llm"
? "text-xs text-primary font-medium"
: "text-xs text-muted-foreground font-medium"
}
>
LLM Requests
</p>
{selectedTab === "llm" && (
<Separator className="bg-primary h-[2px]" />
)}
</Button>
{!importTrace && (
<Button
onClick={() => setSelectedTab("logs")}
Expand All @@ -212,7 +238,7 @@ export const TraceRow = ({
: "text-xs text-muted-foreground font-medium"
}
>
Logs
{`Logs (${trace?.length ?? 0} total)`}
</p>
{selectedTab === "logs" && (
<Separator className="bg-primary h-[2px]" />
Expand All @@ -233,32 +259,13 @@ export const TraceRow = ({
: "text-xs text-muted-foreground font-medium"
}
>
Events
Events/Errors
</p>
{selectedTab === "events" && (
<Separator className="bg-primary h-[2px]" />
)}
</Button>
)}
<Button
disabled={prompts.length === 0 || responses.length === 0}
onClick={() => setSelectedTab("llm")}
variant={"ghost"}
className="flex flex-col justify-between pb-0"
>
<p
className={
selectedTab === "llm"
? "text-xs text-primary font-medium"
: "text-xs text-muted-foreground font-medium"
}
>
LLM Requests
</p>
{selectedTab === "llm" && (
<Separator className="bg-primary h-[2px]" />
)}
</Button>
{langgraph && !importTrace && (
<Button
onClick={() => setSelectedTab("langgraph")}
Expand Down
72 changes: 70 additions & 2 deletions components/shared/vendor-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ export function vendorBadgeColor(vendor: string) {
return "bg-grey-500";
}

if (vendor.includes("qdrant")) {
return "bg-grey-500";
if (vendor.includes("dspy")) {
return "bg-red-500";
}

if (vendor.includes("weaviate")) {
return "bg-green-500";
}

if (vendor.includes("pg")) {
return "bg-blue-500";
}

return "bg-gray-500";
Expand Down Expand Up @@ -98,6 +106,18 @@ export function vendorColor(vendor: string) {
return "bg-slate-200";
}

if (vendor.includes("dspy")) {
return "bg-red-200";
}

if (vendor.includes("weaviate")) {
return "bg-green-200";
}

if (vendor.includes("pg")) {
return "bg-blue-200";
}

return "bg-gray-800";
}

Expand Down Expand Up @@ -279,6 +299,54 @@ export function VendorLogo({
);
}

if (vendor.includes("dspy")) {
const color = vendorColor("dspy");
return (
<Image
alt="DSPy Logo"
src="/dspy.png"
width={50}
height={50}
className={cn(
`${color} p-[3px]`,
variant === "circular" ? "rounded-full" : "rounded-md"
)}
/>
);
}

if (vendor.includes("weaviate")) {
const color = vendorColor("weaviate");
return (
<Image
alt="Weaviate Logo"
src="/weaviate.png"
width={50}
height={50}
className={cn(
`${color} p-[3px]`,
variant === "circular" ? "rounded-full" : "rounded-md"
)}
/>
);
}

if (vendor.includes("pg")) {
const color = vendorColor("pg");
return (
<Image
alt="Postgres Logo"
src="/pg.png"
width={50}
height={50}
className={cn(
`${color} p-[3px]`,
variant === "circular" ? "rounded-full" : "rounded-md"
)}
/>
);
}

return (
<div className="flex items-center bg-muted p-2 rounded-sm">
<StackIcon
Expand Down
4 changes: 4 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export const OPENAI_PRICING: Record<string, CostTableEntry> = {
input: 0.0005,
output: 0.0015,
},
"gpt-3.5-turbo-0613": {
input: 0.0005,
output: 0.0015,
},
"gpt-3.5-turbo-instruct": {
input: 0.0015,
output: 0.002,
Expand Down
2 changes: 2 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ export function getVendorFromSpan(span: Span): string {
vendor = "weaviate";
} else if (span.name.includes("pg") || serviceName.includes("pg")) {
vendor = "pg";
} else if (span.name.includes("dspy") || serviceName.includes("dspy")) {
vendor = "dspy";
}
return vendor;
}
Binary file added public/dspy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/pg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/weaviate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.