-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.ts
29 lines (25 loc) · 780 Bytes
/
post.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { ChatOllama } from "@langchain/community/chat_models/ollama";
import { z } from "zod";
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
import { generateContent } from "~/server/features/self-eval-graph";
export const postRouter = createTRPCRouter({
hello: publicProcedure
.input(z.object({ text: z.string() }))
.mutation(async ({ input }) => {
const workerModel = new ChatOllama({
model: "mistral",
temperature: 0.6,
});
const evalModel = new ChatOllama({
model: "mistral",
temperature: 0.1,
});
const response = await generateContent(
input.text,
workerModel,
evalModel,
);
console.log(response);
return { response };
}),
});