forked from Helicone/helicone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,522 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
{ | ||
"watch": ["packages/jawn/src/**/*", "packages/helicone-shared-ts/src/**/*"], | ||
"watch": [ | ||
"packages/jawn/src/**/*", | ||
"packages/helicone-shared-ts/src/**/*", | ||
"packages/jawn/src/schema/openapi.yml" | ||
], | ||
|
||
"ext": "ts,tsx,js,json", | ||
"exec": "yarn workspace helicone-shared-ts build && ts-node packages/jawn/src/index.ts", | ||
"ignore": ["node_modules/*", "packages/*/node_modules/*"], | ||
"exec": "openapi-typescript packages/jawn/src/schema/openapi.yml --output packages/jawn/src/schema/types.d.ts && yarn workspace helicone-shared-ts build && ts-node packages/jawn/src/index.ts ", | ||
"ignore": [ | ||
"node_modules/*", | ||
"packages/*/node_modules/*", | ||
"packages/jawn/src/schema/types.d.ts" | ||
], | ||
"delay": "1000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
valhalla/packages/helicone-shared-ts/src/db/valhalla.database.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export interface ValhallaRequest { | ||
id: string; // uuid | ||
createdAt: Date; // timestamp with time zone | ||
body: any; // jsonb | ||
urlHref: string; // text | ||
userId: string | null; // text, nullable | ||
properties: any | null; // jsonb, nullable | ||
heliconeApiKeyID: bigint | null; // bigint, nullable | ||
heliconeOrgID: string | null; // uuid, nullable | ||
provider: string; // text with default value 'OPENAI' | ||
heliconeProxyKeyID: string | null; // uuid, nullable | ||
} | ||
|
||
export interface ValhallaResponse { | ||
id: string; // uuid | ||
createdAt: Date; // timestamp with time zone | ||
body: any; // jsonb | ||
request: string; // uuid (foreign key to Request) | ||
delayMs: number | null; // integer, nullable | ||
http_status: number | null; // smallint, nullable | ||
completionTokens: number | null; // integer, nullable | ||
model: string | null; // text, nullable | ||
promptTokens: number | null; // integer, nullable | ||
} | ||
|
||
export interface ValhallaCacheHits { | ||
createdAt: Date; // timestamp with time zone | ||
requestID: string; // uuid (foreign key to Request) | ||
} | ||
|
||
export interface ValhallaFeedback { | ||
responseID: string; // uuid (foreign key to Response) | ||
rating: boolean; // boolean | ||
createdAt: Date; // timestamp with time zone | ||
id: string; // uuid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
valhalla/packages/helicone-shared-ts/src/requestWrapper/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
Request as ExpressRequest, | ||
Response as ExpressResponse, | ||
} from "express"; | ||
|
||
export class RequestWrapper<T> { | ||
constructor(private request: ExpressRequest) {} | ||
|
||
public async getBody(): Promise<T> { | ||
return await this.request.body; | ||
} | ||
|
||
public authHeader(): string | undefined { | ||
return this.request.headers.authorization; | ||
} | ||
|
||
public heliconeOrgId(): string | undefined { | ||
return (this.request.headers["helicone-org-id"] as string) ?? undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.