🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";
import { createAuthedProjectAPIRoute } from "@/src/features/public-api/server/createAuthedProjectAPIRoute";
import {
createCommentForApi,
listCommentsForApi,
} from "@/src/features/comments/server/publicCommentService";
import {
GetCommentsV1Query,
GetCommentsV1Response,
PostCommentsV1Body,
PostCommentsV1Response,
} from "@/src/features/public-api/types/comments";
export default withMiddlewares({
POST: createAuthedProjectAPIRoute({
name: "Create Comment",
action: "comments:CUD",
bodySchema: PostCommentsV1Body,
responseSchema: PostCommentsV1Response,
fn: async ({ body, auth }) =>
await createCommentForApi({ input: body, auditScope: auth.scope }),
}),
GET: createAuthedProjectAPIRoute({
name: "Get Comments",
action: "comments:read",
querySchema: GetCommentsV1Query,
responseSchema: GetCommentsV1Response,
fn: async ({ query, auth }) =>
await listCommentsForApi({ ...query, projectId: auth.scope.projectId }),
}),
});