Skip to content

Commit

Permalink
Change to open ai
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed May 20, 2024
1 parent a7901a4 commit 4b23452
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions apps/dashboard/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ PLAIN_API_KEY=
BASELIME_SERVICE=
BASELIME_API_KEY=

# Groq
GROQ_API_KEY=
# OpenAI
OPENAI_API_KEY=
1 change: 0 additions & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@baselime/node-opentelemetry": "^0.5.8",
"@date-fns/utc": "^1.2.0",
"@hookform/resolvers": "^3.4.0",
"@langchain/groq": "^0.0.11",
"@midday/events": "workspace:*",
"@midday/inbox": "workspace:*",
"@midday/jobs": "workspace:*",
Expand Down
8 changes: 4 additions & 4 deletions apps/dashboard/src/actions/ai/get-vat-rate.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"use server";

import { ChatPromptTemplate } from "@langchain/core/prompts";
import { ChatGroq } from "@langchain/groq";
import { ChatOpenAI } from "@langchain/openai";
import { getCountry } from "@midday/location";
import { z } from "zod";
import { action } from "../safe-action";
import { getVatRateSchema } from "../schema";

const model = new ChatGroq({
const model = new ChatOpenAI({
temperature: 0,
model: "mixtral-8x7b-32768",
apiKey: process.env.GROQ_API_KEY,
model: "gpt-4o",
apiKey: process.env.OPENAI_API_KEY,
});

const vatSchema = z.object({
Expand Down
16 changes: 2 additions & 14 deletions apps/dashboard/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ export const env = createEnv({
.optional()
.transform((v) => (v ? `https://${v}` : undefined)),
PORT: z.coerce.number().default(3000),
RESEND_API_KEY: z.string(),
LOOPS_ENDPOINT: z.string(),
LOOPS_API_KEY: z.string(),
GOCARDLESS_SECRET_ID: z.string(),
GOCARDLESS_SECRET_KEY: z.string(),
NOVU_API_KEY: z.string(),
UPSTASH_REDIS_REST_URL: z.string(),
UPSTASH_REDIS_REST_TOKEN: z.string(),
SUPABASE_SERVICE_KEY: z.string(),
GROQ_API_KEY: z.string(),
API_ROUTE_SECRET: z.string(),
PLAIN_API_KEY: z.string(),
},
/**
* Specify your server-side environment variables schema here. This way you can ensure the app isn't
Expand All @@ -30,7 +18,7 @@ export const env = createEnv({
GOOGLE_APPLICATION_EXPENSE_PROCESSOR_ID: z.string(),
PLAIN_API_KEY: z.string(),
API_ROUTE_SECRET: z.string(),
GROQ_API_KEY: z.string(),
OPENAI_API_KEY: z.string(),
SUPABASE_SERVICE_KEY: z.string(),
UPSTASH_REDIS_REST_TOKEN: z.string(),
UPSTASH_REDIS_REST_URL: z.string(),
Expand Down Expand Up @@ -88,7 +76,7 @@ export const env = createEnv({
NEXT_PUBLIC_LOGSNAG_TOKEN: process.env.NEXT_PUBLIC_LOGSNAG_TOKEN,
NEXT_PUBLIC_LOGSNAG_PROJECT: process.env.NEXT_PUBLIC_LOGSNAG_PROJECT,
SUPABASE_SERVICE_KEY: process.env.SUPABASE_SERVICE_KEY,
GROQ_API_KEY: process.env.GROQ_API_KEY,
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
API_ROUTE_SECRET: process.env.API_ROUTE_SECRET,
PLAIN_API_KEY: process.env.PLAIN_API_KEY,
GOOGLE_APPLICATION_INVOICE_PROCESSOR_ID: process.env.PLAIN_API_KEY,
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/import/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function csvTransformed({
teamId,
}: CsvTransformedParams) {
const originalCsv = parseCsv(raw);
const firstFewRows = extracted.splice(0, 20);
const firstFewRows = extracted.splice(5, 20);

const dateIndex = findIndexesByKey({
raw: originalCsv,
Expand Down
2 changes: 1 addition & 1 deletion packages/import/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function transform(transaction: TransformTransaction) {

export function parseCsv(input: string) {
return parse(input, {
delimiter: [",", ";", ".", " "],
delimiter: [",", ";", "."],
skip_empty_lines: true,
skip_records_with_empty_values: true,
skip_records_with_error: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/jobs/src/transactions/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ client.defineJob({
const results = await extractionChain.batch(extractionChainParams);
const transactions = results.flatMap((result) => result.transactions);

console.log(transactions);

const transformedTransactions = csvTransformed({
raw: rawText,
extracted: transactions,
Expand Down

0 comments on commit 4b23452

Please sign in to comment.