Skip to content

Commit

Permalink
migrate opensearch to clickhouse (#279)
Browse files Browse the repository at this point in the history
* migrate opensearch to clickhouse

* fix formatting

* add mysql2 to implicitDeps

* fix formatting

* update package json and knexfile

* fix formatting

* test failing migration script

* fix knex migration
  • Loading branch information
arielweinberger authored Dec 31, 2023
1 parent d30bbc7 commit cf2853e
Show file tree
Hide file tree
Showing 106 changed files with 3,829 additions and 1,822 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ schema.graphql
temp
tmp

kms/data
kms/data

volumes
3 changes: 2 additions & 1 deletion .nxignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github
.next
.next
volumes
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
libs/common/src/version.json
**/.next
/docs
volumes
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{}
{
"sqltools.connections": [
{
"server": "localhost",
"port": 8123,
"useHTTPS": false,
"database": "default",
"username": "default",
"password": "",
"tls": {},
"previewLimit": 50,
"driver": "ClickHouse",
"name": "Local"
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ npm install

### Spin up infrastructure dependencies via Docker Compose

Pezzo is entirely cloud-native and relies solely on open-source technologies such as [PostgreSQL](https://www.postgresql.org/), [OpenSearch](https://github.com/opensearch-project/OpenSearch), [Redis](https://github.com/redis/redis) and [Supertokens](https://supertokens.com/).
Pezzo is entirely cloud-native and relies solely on open-source technologies such as [PostgreSQL](https://www.postgresql.org/), [ClickHouse](https://github.com/ClickHouse/ClickHouse), [Redis](https://github.com/redis/redis) and [Supertokens](https://supertokens.com/).

You can run these dependencies via Docker Compose:

Expand Down
2 changes: 1 addition & 1 deletion apps/console/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"options": {},
"configurations": {
"local": {
"tags": ["pezzolabs/pezzo/console"],
"tags": ["ghcr.io/pezzolabs/pezzo/console"],
"push": false
}
}
Expand Down
2 changes: 0 additions & 2 deletions apps/console/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { PromptEditView } from "./features/editor/PromptEditView";
import { EditorProvider } from "./lib/providers/EditorContext";
import { PromptTesterProvider } from "./lib/providers/PromptTesterContext";
import { PromptVersionsView } from "./components/prompts/views/PromptVersionsView";
import { PromptMetricsView } from "./components/prompts/views/PromptMetricsView";
import { Suspense } from "react";
import { FullScreenLoader } from "./components/common/FullScreenLoader";
import { OrgPage } from "./pages/projects/OrgPage";
Expand Down Expand Up @@ -158,7 +157,6 @@ export function App() {
}
/>
<Route path="versions" element={<PromptVersionsView />} />
<Route path="metrics" element={<PromptMetricsView />} />
</Route>
</Route>
</Route>
Expand Down
Binary file added apps/console/src/assets/providers/anthropic-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion apps/console/src/assets/providers/anthropic-logo.svg

This file was deleted.

Binary file added apps/console/src/assets/providers/azure-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions apps/console/src/assets/providers/azure-logo.svg

This file was deleted.

Binary file added apps/console/src/assets/providers/meta-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 apps/console/src/assets/providers/openai-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion apps/console/src/assets/providers/openai-logo.svg

This file was deleted.

1 change: 1 addition & 0 deletions apps/console/src/components/metrics/StatisticBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const getProperties = (
const calculatedPreviousValue = previousValue === 0 ? 1 : previousValue;

const percentage = Math.abs((diff / calculatedPreviousValue) * 100);

const percentageToRender =
percentage < 1 ? percentage.toFixed(3) : percentage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ import { promptProvidersMapping } from "@pezzo/types";
import { PromptService } from "~/@generated/graphql/graphql";

// Logos
import OpenAILogo from "~/assets/providers/openai-logo.svg";
import AzureOpenAILogo from "~/assets/providers/azure-logo.svg";
import AnthropicLogo from "~/assets/providers/anthropic-logo.svg";
import OpenAILogo from "~/assets/providers/openai-logo.png";
import AzureOpenAILogo from "~/assets/providers/azure-logo.png";
import AnthropicLogo from "~/assets/providers/anthropic-logo.png";

export const providersList: ProviderProps[] = [
{
image: (
<img
alt="OpenAI"
src={OpenAILogo}
className="w-6 rounded-sm bg-[#74AA9C] p-[2px]"
/>
),
image: <img alt="OpenAI" src={OpenAILogo} className="w-6 rounded-sm" />,
value: PromptService.OpenAiChatCompletion,
label: promptProvidersMapping[PromptService.OpenAiChatCompletion].name,
},
Expand All @@ -24,19 +18,15 @@ export const providersList: ProviderProps[] = [
<img
alt="Azure OpenAI"
src={AzureOpenAILogo}
className="w-6 rounded-sm bg-white p-[2px]"
className="w-6 rounded-sm"
/>
),
value: PromptService.AzureOpenAiChatCompletion,
label: promptProvidersMapping[PromptService.AzureOpenAiChatCompletion].name,
},
{
image: (
<img
alt="Anthropic"
src={AnthropicLogo}
className=" w-6 rounded-sm p-[2px]"
/>
<img alt="Anthropic" src={AnthropicLogo} className=" w-6 rounded-sm" />
),
value: PromptService.AnthropicCompletion,
label: promptProvidersMapping[PromptService.AnthropicCompletion].name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
AlertTitle,
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@pezzo/ui";
import { AlertCircle } from "lucide-react";
import { cn } from "@pezzo/ui/utils";
Expand Down Expand Up @@ -49,18 +47,7 @@ export const PromptTesterModal = () => {
{!testResult && <VariablesStep onSubmit={handleSubmitVariables} />}
{testResult && (
<div className="w-full">
<RequestDetails
disableCopy
id={testResult.reportId}
request={testResult.request}
response={testResult.response}
provider={testResult.metadata.provider}
calculated={testResult.calculated}
metadata={testResult.metadata}
properties={testResult.properties}
cacheEnabled={testResult.cacheEnabled}
cacheHit={testResult.cacheHit}
/>
<RequestDetails id={testResult.id} />
</div>
)}
</div>
Expand Down
60 changes: 0 additions & 60 deletions apps/console/src/components/prompts/views/PromptMetricsView.tsx

This file was deleted.

Loading

0 comments on commit cf2853e

Please sign in to comment.