Trigger llm output retrieval on server (#39)

* Rename tables, add graphile workers, update types

* Add dev:worker command

* Update pnpm-lock.yaml

* Remove sentry config import from worker.ts

* Stop generating new cells in cell router get query

* Generate new cells for new scenarios, variants, and experiments

* Remove most error throwing from queryLLM.task.ts

* Remove promptVariantId and testScenarioId from ModelOutput

* Remove duplicate index from ModelOutput

* Move inputHash from cell to output

* Add TODO

* Add todo

* Show cost and time for each cell

* Always show output stats if there is output

* Trigger LLM outputs when scenario variables are updated

* Add newlines to ends of files

* Add another newline

* Cascade ModelOutput deletion

* Fix linting and prettier

* Return instead of throwing for non-pending cell

* Remove pnpm dev:worker from pnpm:dev

* Update pnpm-lock.yaml
This commit is contained in:
arcticfly
2023-07-14 16:38:46 -06:00
committed by GitHub
parent 032c07ec65
commit b98eb9b729
29 changed files with 1089 additions and 407 deletions

View File

@@ -41,7 +41,7 @@ model PromptVariant {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ModelOutput ModelOutput[]
scenarioVariantCells ScenarioVariantCell[]
EvaluationResult EvaluationResult[]
@@index([uiId])
@@ -61,7 +61,7 @@ model TestScenario {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ModelOutput ModelOutput[]
scenarioVariantCells ScenarioVariantCell[]
}
model TemplateVariable {
@@ -76,17 +76,28 @@ model TemplateVariable {
updatedAt DateTime @updatedAt
}
model ModelOutput {
enum CellRetrievalStatus {
PENDING
IN_PROGRESS
COMPLETE
ERROR
}
model ScenarioVariantCell {
id String @id @default(uuid()) @db.Uuid
inputHash String
output Json
statusCode Int
errorMessage String?
timeToComplete Int @default(0)
inputHash String? // TODO: Remove once migration is complete
output Json? // TODO: Remove once migration is complete
statusCode Int?
errorMessage String?
timeToComplete Int? @default(0) // TODO: Remove once migration is complete
retryTime DateTime?
streamingChannel String?
retrievalStatus CellRetrievalStatus @default(COMPLETE)
promptTokens Int? // Added promptTokens field
completionTokens Int? // Added completionTokens field
promptTokens Int? // TODO: Remove once migration is complete
completionTokens Int? // TODO: Remove once migration is complete
modelOutput ModelOutput?
promptVariantId String @db.Uuid
promptVariant PromptVariant @relation(fields: [promptVariantId], references: [id], onDelete: Cascade)
@@ -98,6 +109,24 @@ model ModelOutput {
updatedAt DateTime @updatedAt
@@unique([promptVariantId, testScenarioId])
}
model ModelOutput {
id String @id @default(uuid()) @db.Uuid
inputHash String
output Json
timeToComplete Int @default(0)
promptTokens Int?
completionTokens Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
scenarioVariantCellId String @db.Uuid
scenarioVariantCell ScenarioVariantCell @relation(fields: [scenarioVariantCellId], references: [id], onDelete: Cascade)
@@unique([scenarioVariantCellId])
@@index([inputHash])
}