Skip to content

Commit

Permalink
embed the right data
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinvalli committed Oct 25, 2024
1 parent 13e2200 commit 9209a76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
2 changes: 0 additions & 2 deletions valhalla/jawn/src/controllers/public/requestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ export class RequestController extends Controller {
requestBody.filter
);

console.log("length of clusters", clusters.data?.length);

if (clusters.error) {
this.setStatus(500);
} else {
Expand Down
2 changes: 1 addition & 1 deletion valhalla/jawn/src/lib/handlers/EmbeddingsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class EmbeddingsHandler extends AbstractLogHandler {

try {
const embedding = await openai.embeddings.create({
input: JSON.stringify(request.properties), // TODO: is this the right thing to do?
input: JSON.stringify(requestBody), // TODO: is this the right thing to do?
model: "text-embedding-3-small",
});

Expand Down
29 changes: 15 additions & 14 deletions web/components/templates/clusters/clustersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ const ClustersPage = () => {
<div className="flex flex-col gap-4">
<h1>Clusters</h1>
<Plot
data={[
{
x: clusters.map((c) => c?.x ?? 0),
y: clusters.map((c) => c?.y ?? 0),
type: "scatter",
mode: "markers",
text: clusters.map((c) => c?.cluster ?? ""),
marker: {
size: 10,
color: clusters.map((c) => c?.cluster ?? 0),
},
hovertext: clusters.map((c) => c?.request_id ?? ""),
},
]}
data={uniqueClusters.map((cluster) => ({
x: clusters
.filter((c) => c?.cluster === cluster)
.map((c) => c?.x ?? 0),
y: clusters
.filter((c) => c?.cluster === cluster)
.map((c) => c?.y ?? 0),
type: "scattergl",
mode: "markers",
hovertext: clusters
.filter((c) => c?.cluster === cluster)
.map((c) => c?.request_id ?? ""),
}))}
onClick={(data) => {
console.log(data);
// @ts-ignore
Expand All @@ -75,6 +74,8 @@ const ClustersPage = () => {
}}
layout={{
title: "Clusters",
plot_bgcolor: "transparent",
paper_bgcolor: "transparent",
}}
/>

Expand Down

0 comments on commit 9209a76

Please sign in to comment.