Merge pull request #139 from OpenPipe/python-sdk
Add a python client library
This commit is contained in:
@@ -35,6 +35,7 @@ export const externalApiRouter = createTRPCRouter({
|
||||
method: "POST",
|
||||
path: "/v1/check-cache",
|
||||
description: "Check if a prompt is cached",
|
||||
protect: true,
|
||||
},
|
||||
})
|
||||
.input(
|
||||
@@ -102,6 +103,7 @@ export const externalApiRouter = createTRPCRouter({
|
||||
method: "POST",
|
||||
path: "/v1/report",
|
||||
description: "Report an API call",
|
||||
protect: true,
|
||||
},
|
||||
})
|
||||
.input(
|
||||
@@ -122,6 +124,7 @@ export const externalApiRouter = createTRPCRouter({
|
||||
)
|
||||
.output(z.void())
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
console.log("GOT TAGS", input.tags);
|
||||
const apiKey = ctx.apiKey;
|
||||
if (!apiKey) {
|
||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
|
||||
@@ -64,7 +64,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
|
||||
// Get the session from the server using the getServerSession wrapper function
|
||||
const session = await getServerAuthSession({ req, res });
|
||||
|
||||
const apiKey = req.headers["x-openpipe-api-key"] as string | null;
|
||||
const apiKey = req.headers.authorization?.split(" ")[1] as string | null;
|
||||
|
||||
return createInnerTRPCContext({
|
||||
session,
|
||||
|
||||
Reference in New Issue
Block a user