attempt render deploy

This commit is contained in:
Kyle Corbitt
2023-06-26 14:58:01 -07:00
parent 12af15ae32
commit dbc61b8672
7 changed files with 80 additions and 4 deletions

View File

@@ -1,8 +1,11 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import YAML from "yaml";
import fs from "fs";
import path from "path";
import { openapiSchemaToJsonSchema } from "@openapi-contrib/openapi-schema-to-json-schema";
import assert from "assert";
import { AcceptibleInputSchema } from "@openapi-contrib/openapi-schema-to-json-schema/dist/mjs/openapi-schema-types";
const OPENAPI_URL =
"https://raw.githubusercontent.com/openai/openai-openapi/0c432eb66fd0c758fd8b9bd69db41c1096e5f4db/openapi.yaml";
@@ -13,7 +16,7 @@ const convertOpenApiToJsonSchema = async (url: string) => {
const openApiYaml = await response.text();
// Parse the yaml document
const openApiDocument = YAML.parse(openApiYaml) as unknown;
const openApiDocument = YAML.parse(openApiYaml) as AcceptibleInputSchema;
// Convert the openapi schema to json schema
const jsonSchema = openapiSchemaToJsonSchema(openApiDocument);

View File

@@ -58,6 +58,7 @@ export default function OutputCell({
if (!output.data) return <CellShell>No output</CellShell>;
return (
// @ts-expect-error TODO proper typing and error checks
<CellShell>{JSON.stringify(output.data.output.choices[0].message.content, null, 2)}</CellShell>
);
}

View File

@@ -5,6 +5,7 @@ import fillTemplate, { VariableMap } from "~/server/utils/fillTemplate";
import { JSONSerializable } from "~/server/types";
import { getChatCompletion } from "~/server/utils/openai";
import crypto from "crypto";
import type { Prisma } from "@prisma/client";
export const modelOutputsRouter = createTRPCRouter({
get: publicProcedure
@@ -62,7 +63,7 @@ export const modelOutputsRouter = createTRPCRouter({
data: {
promptVariantId: input.variantId,
testScenarioId: input.scenarioId,
output: modelResponse,
output: modelResponse as Prisma.InputJsonObject,
inputHash,
},
});