Move the external API into its own router
Auth logic isn't shared between the clients anyway, so co-locating them is confusing since you can't use the same clients to call both. This also makes the codegen clients less verbose.
This commit is contained in:
5
app/@types/nextjs-routes.d.ts
vendored
5
app/@types/nextjs-routes.d.ts
vendored
@@ -12,12 +12,11 @@ declare module "nextjs-routes" {
|
|||||||
|
|
||||||
export type Route =
|
export type Route =
|
||||||
| StaticRoute<"/account/signin">
|
| StaticRoute<"/account/signin">
|
||||||
| DynamicRoute<"/api/[...trpc]", { "trpc": string[] }>
|
|
||||||
| DynamicRoute<"/api/auth/[...nextauth]", { "nextauth": string[] }>
|
| DynamicRoute<"/api/auth/[...nextauth]", { "nextauth": string[] }>
|
||||||
| StaticRoute<"/api/experiments/og-image">
|
| StaticRoute<"/api/experiments/og-image">
|
||||||
| StaticRoute<"/api/openapi">
|
|
||||||
| StaticRoute<"/api/sentry-example-api">
|
|
||||||
| DynamicRoute<"/api/trpc/[trpc]", { "trpc": string }>
|
| DynamicRoute<"/api/trpc/[trpc]", { "trpc": string }>
|
||||||
|
| DynamicRoute<"/api/v1/[...trpc]", { "trpc": string[] }>
|
||||||
|
| StaticRoute<"/api/v1/openapi">
|
||||||
| StaticRoute<"/dashboard">
|
| StaticRoute<"/dashboard">
|
||||||
| DynamicRoute<"/data/[id]", { "id": string }>
|
| DynamicRoute<"/data/[id]", { "id": string }>
|
||||||
| StaticRoute<"/data">
|
| StaticRoute<"/data">
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ model ApiKey {
|
|||||||
apiKey String @unique
|
apiKey String @unique
|
||||||
|
|
||||||
projectId String @db.Uuid
|
projectId String @db.Uuid
|
||||||
project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
// A faulty API route to test Sentry's error monitoring
|
|
||||||
// @ts-expect-error just a test file, don't care about types
|
|
||||||
export default function handler(_req, res) {
|
|
||||||
throw new Error("Sentry Example API Route Error");
|
|
||||||
res.status(200).json({ name: "John Doe" });
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
import { type NextApiRequest, type NextApiResponse } from "next";
|
import { type NextApiRequest, type NextApiResponse } from "next";
|
||||||
import cors from "nextjs-cors";
|
import cors from "nextjs-cors";
|
||||||
import { createOpenApiNextHandler } from "trpc-openapi";
|
import { createOpenApiNextHandler } from "trpc-openapi";
|
||||||
import { createProcedureCache } from "trpc-openapi/dist/adapters/node-http/procedures";
|
import { v1ApiRouter } from "~/server/api/external/v1Api.router";
|
||||||
import { appRouter } from "~/server/api/root.router";
|
import { createOpenApiContext } from "~/server/api/external/openApiTrpc";
|
||||||
import { createTRPCContext } from "~/server/api/trpc";
|
|
||||||
|
|
||||||
const openApiHandler = createOpenApiNextHandler({
|
const openApiHandler = createOpenApiNextHandler({
|
||||||
router: appRouter,
|
router: v1ApiRouter,
|
||||||
createContext: createTRPCContext,
|
createContext: createOpenApiContext,
|
||||||
});
|
});
|
||||||
|
|
||||||
const cache = createProcedureCache(appRouter);
|
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
// Setup CORS
|
// Setup CORS
|
||||||
await cors(req, res);
|
await cors(req, res);
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { type NextApiRequest, type NextApiResponse } from "next";
|
import { type NextApiRequest, type NextApiResponse } from "next";
|
||||||
import { generateOpenApiDocument } from "trpc-openapi";
|
import { generateOpenApiDocument } from "trpc-openapi";
|
||||||
import { appRouter } from "~/server/api/root.router";
|
import { v1ApiRouter } from "~/server/api/external/v1Api.router";
|
||||||
|
|
||||||
export const openApiDocument = generateOpenApiDocument(appRouter, {
|
export const openApiDocument = generateOpenApiDocument(v1ApiRouter, {
|
||||||
title: "OpenPipe API",
|
title: "OpenPipe API",
|
||||||
description: "The public API for reporting API calls to OpenPipe",
|
description: "The public API for reporting API calls to OpenPipe",
|
||||||
version: "0.1.0",
|
version: "0.1.1",
|
||||||
baseUrl: "https://app.openpipe.ai/api",
|
baseUrl: "https://app.openpipe.ai/api/v1",
|
||||||
});
|
});
|
||||||
// Respond with our OpenAPI schema
|
// Respond with our OpenAPI schema
|
||||||
const hander = (req: NextApiRequest, res: NextApiResponse) => {
|
const hander = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
95
app/src/server/api/external/openApiTrpc.ts
vendored
Normal file
95
app/src/server/api/external/openApiTrpc.ts
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import type { ApiKey, Project } from "@prisma/client";
|
||||||
|
import { TRPCError, initTRPC } from "@trpc/server";
|
||||||
|
import { type CreateNextContextOptions } from "@trpc/server/adapters/next";
|
||||||
|
import superjson from "superjson";
|
||||||
|
import { type OpenApiMeta } from "trpc-openapi";
|
||||||
|
import { ZodError } from "zod";
|
||||||
|
import { prisma } from "~/server/db";
|
||||||
|
|
||||||
|
type CreateContextOptions = {
|
||||||
|
key:
|
||||||
|
| (ApiKey & {
|
||||||
|
project: Project;
|
||||||
|
})
|
||||||
|
| null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This helper generates the "internals" for a tRPC context. If you need to use it, you can export
|
||||||
|
* it from here.
|
||||||
|
*
|
||||||
|
* Examples of things you may need it for:
|
||||||
|
* - testing, so we don't have to mock Next.js' req/res
|
||||||
|
* - tRPC's `createSSGHelpers`, where we don't have req/res
|
||||||
|
*
|
||||||
|
* @see https://create.t3.gg/en/usage/trpc#-serverapitrpcts
|
||||||
|
*/
|
||||||
|
export const createInnerTRPCContext = (opts: CreateContextOptions) => {
|
||||||
|
return {
|
||||||
|
key: opts.key,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createOpenApiContext = async (opts: CreateNextContextOptions) => {
|
||||||
|
const { req, res } = opts;
|
||||||
|
|
||||||
|
const apiKey = req.headers.authorization?.split(" ")[1] as string | null;
|
||||||
|
|
||||||
|
if (!apiKey) {
|
||||||
|
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||||
|
}
|
||||||
|
const key = await prisma.apiKey.findUnique({
|
||||||
|
where: { apiKey },
|
||||||
|
include: { project: true },
|
||||||
|
});
|
||||||
|
if (!key) {
|
||||||
|
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||||
|
}
|
||||||
|
|
||||||
|
return createInnerTRPCContext({
|
||||||
|
key,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TRPCContext = Awaited<ReturnType<typeof createOpenApiContext>>;
|
||||||
|
|
||||||
|
const t = initTRPC
|
||||||
|
.context<typeof createOpenApiContext>()
|
||||||
|
.meta<OpenApiMeta>()
|
||||||
|
.create({
|
||||||
|
transformer: superjson,
|
||||||
|
errorFormatter({ shape, error }) {
|
||||||
|
return {
|
||||||
|
...shape,
|
||||||
|
data: {
|
||||||
|
...shape.data,
|
||||||
|
zodError: error.cause instanceof ZodError ? error.cause.flatten() : null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const createOpenApiRouter = t.router;
|
||||||
|
|
||||||
|
export const openApiPublicProc = t.procedure;
|
||||||
|
|
||||||
|
/** Reusable middleware that enforces users are logged in before running the procedure. */
|
||||||
|
const enforceApiKey = t.middleware(async ({ ctx, next }) => {
|
||||||
|
if (!ctx.key) {
|
||||||
|
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||||
|
}
|
||||||
|
|
||||||
|
return next({
|
||||||
|
ctx: { key: ctx.key },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protected (authenticated) procedure
|
||||||
|
*
|
||||||
|
* If you want a query or mutation to ONLY be accessible to logged in users, use this. It verifies
|
||||||
|
* the session is valid and guarantees `ctx.session.user` is not null.
|
||||||
|
*
|
||||||
|
* @see https://trpc.io/docs/procedures
|
||||||
|
*/
|
||||||
|
export const openApiProtectedProc = t.procedure.use(enforceApiKey);
|
||||||
@@ -2,9 +2,6 @@ import { type Prisma } from "@prisma/client";
|
|||||||
import { type JsonValue } from "type-fest";
|
import { type JsonValue } from "type-fest";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import { TRPCError } from "@trpc/server";
|
|
||||||
|
|
||||||
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
|
|
||||||
import { prisma } from "~/server/db";
|
import { prisma } from "~/server/db";
|
||||||
import { hashRequest } from "~/server/utils/hashObject";
|
import { hashRequest } from "~/server/utils/hashObject";
|
||||||
import modelProvider from "~/modelProviders/openai-ChatCompletion";
|
import modelProvider from "~/modelProviders/openai-ChatCompletion";
|
||||||
@@ -12,6 +9,7 @@ import {
|
|||||||
type ChatCompletion,
|
type ChatCompletion,
|
||||||
type CompletionCreateParams,
|
type CompletionCreateParams,
|
||||||
} from "openai/resources/chat/completions";
|
} from "openai/resources/chat/completions";
|
||||||
|
import { createOpenApiRouter, openApiProtectedProc } from "./openApiTrpc";
|
||||||
|
|
||||||
const reqValidator = z.object({
|
const reqValidator = z.object({
|
||||||
model: z.string(),
|
model: z.string(),
|
||||||
@@ -28,12 +26,12 @@ const respValidator = z.object({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const externalApiRouter = createTRPCRouter({
|
export const v1ApiRouter = createOpenApiRouter({
|
||||||
checkCache: publicProcedure
|
checkCache: openApiProtectedProc
|
||||||
.meta({
|
.meta({
|
||||||
openapi: {
|
openapi: {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/v1/check-cache",
|
path: "/check-cache",
|
||||||
description: "Check if a prompt is cached",
|
description: "Check if a prompt is cached",
|
||||||
protect: true,
|
protect: true,
|
||||||
},
|
},
|
||||||
@@ -56,18 +54,8 @@ export const externalApiRouter = createTRPCRouter({
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
const apiKey = ctx.apiKey;
|
|
||||||
if (!apiKey) {
|
|
||||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
|
||||||
}
|
|
||||||
const key = await prisma.apiKey.findUnique({
|
|
||||||
where: { apiKey },
|
|
||||||
});
|
|
||||||
if (!key) {
|
|
||||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
|
||||||
}
|
|
||||||
const reqPayload = await reqValidator.spa(input.reqPayload);
|
const reqPayload = await reqValidator.spa(input.reqPayload);
|
||||||
const cacheKey = hashRequest(key.projectId, reqPayload as JsonValue);
|
const cacheKey = hashRequest(ctx.key.projectId, reqPayload as JsonValue);
|
||||||
|
|
||||||
const existingResponse = await prisma.loggedCallModelResponse.findFirst({
|
const existingResponse = await prisma.loggedCallModelResponse.findFirst({
|
||||||
where: { cacheKey },
|
where: { cacheKey },
|
||||||
@@ -79,7 +67,7 @@ export const externalApiRouter = createTRPCRouter({
|
|||||||
|
|
||||||
await prisma.loggedCall.create({
|
await prisma.loggedCall.create({
|
||||||
data: {
|
data: {
|
||||||
projectId: key.projectId,
|
projectId: ctx.key.projectId,
|
||||||
requestedAt: new Date(input.requestedAt),
|
requestedAt: new Date(input.requestedAt),
|
||||||
cacheHit: true,
|
cacheHit: true,
|
||||||
modelResponseId: existingResponse.id,
|
modelResponseId: existingResponse.id,
|
||||||
@@ -91,11 +79,11 @@ export const externalApiRouter = createTRPCRouter({
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
report: publicProcedure
|
report: openApiProtectedProc
|
||||||
.meta({
|
.meta({
|
||||||
openapi: {
|
openapi: {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/v1/report",
|
path: "/report",
|
||||||
description: "Report an API call",
|
description: "Report an API call",
|
||||||
protect: true,
|
protect: true,
|
||||||
},
|
},
|
||||||
@@ -119,20 +107,10 @@ export const externalApiRouter = createTRPCRouter({
|
|||||||
.output(z.void())
|
.output(z.void())
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
console.log("GOT TAGS", input.tags);
|
console.log("GOT TAGS", input.tags);
|
||||||
const apiKey = ctx.apiKey;
|
|
||||||
if (!apiKey) {
|
|
||||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
|
||||||
}
|
|
||||||
const key = await prisma.apiKey.findUnique({
|
|
||||||
where: { apiKey },
|
|
||||||
});
|
|
||||||
if (!key) {
|
|
||||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
|
||||||
}
|
|
||||||
const reqPayload = await reqValidator.spa(input.reqPayload);
|
const reqPayload = await reqValidator.spa(input.reqPayload);
|
||||||
const respPayload = await respValidator.spa(input.respPayload);
|
const respPayload = await respValidator.spa(input.respPayload);
|
||||||
|
|
||||||
const requestHash = hashRequest(key.projectId, reqPayload as JsonValue);
|
const requestHash = hashRequest(ctx.key.project.id, reqPayload as JsonValue);
|
||||||
|
|
||||||
const newLoggedCallId = uuidv4();
|
const newLoggedCallId = uuidv4();
|
||||||
const newModelResponseId = uuidv4();
|
const newModelResponseId = uuidv4();
|
||||||
@@ -151,7 +129,7 @@ export const externalApiRouter = createTRPCRouter({
|
|||||||
prisma.loggedCall.create({
|
prisma.loggedCall.create({
|
||||||
data: {
|
data: {
|
||||||
id: newLoggedCallId,
|
id: newLoggedCallId,
|
||||||
projectId: key.projectId,
|
projectId: ctx.key.project.id,
|
||||||
requestedAt: new Date(input.requestedAt),
|
requestedAt: new Date(input.requestedAt),
|
||||||
cacheHit: false,
|
cacheHit: false,
|
||||||
model,
|
model,
|
||||||
@@ -8,7 +8,6 @@ import { evaluationsRouter } from "./routers/evaluations.router";
|
|||||||
import { worldChampsRouter } from "./routers/worldChamps.router";
|
import { worldChampsRouter } from "./routers/worldChamps.router";
|
||||||
import { datasetsRouter } from "./routers/datasets.router";
|
import { datasetsRouter } from "./routers/datasets.router";
|
||||||
import { datasetEntries } from "./routers/datasetEntries.router";
|
import { datasetEntries } from "./routers/datasetEntries.router";
|
||||||
import { externalApiRouter } from "./routers/externalApi.router";
|
|
||||||
import { projectsRouter } from "./routers/projects.router";
|
import { projectsRouter } from "./routers/projects.router";
|
||||||
import { dashboardRouter } from "./routers/dashboard.router";
|
import { dashboardRouter } from "./routers/dashboard.router";
|
||||||
import { loggedCallsRouter } from "./routers/loggedCalls.router";
|
import { loggedCallsRouter } from "./routers/loggedCalls.router";
|
||||||
@@ -31,7 +30,6 @@ export const appRouter = createTRPCRouter({
|
|||||||
projects: projectsRouter,
|
projects: projectsRouter,
|
||||||
dashboard: dashboardRouter,
|
dashboard: dashboardRouter,
|
||||||
loggedCalls: loggedCallsRouter,
|
loggedCalls: loggedCallsRouter,
|
||||||
externalApi: externalApiRouter,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// export type definition of API
|
// export type definition of API
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import { capturePath } from "~/utils/analytics/serverAnalytics";
|
|||||||
|
|
||||||
type CreateContextOptions = {
|
type CreateContextOptions = {
|
||||||
session: Session | null;
|
session: Session | null;
|
||||||
apiKey: string | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
@@ -46,7 +45,6 @@ const noOp = () => {};
|
|||||||
export const createInnerTRPCContext = (opts: CreateContextOptions) => {
|
export const createInnerTRPCContext = (opts: CreateContextOptions) => {
|
||||||
return {
|
return {
|
||||||
session: opts.session,
|
session: opts.session,
|
||||||
apiKey: opts.apiKey,
|
|
||||||
prisma,
|
prisma,
|
||||||
markAccessControlRun: noOp,
|
markAccessControlRun: noOp,
|
||||||
};
|
};
|
||||||
@@ -64,11 +62,8 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
|
|||||||
// Get the session from the server using the getServerSession wrapper function
|
// Get the session from the server using the getServerSession wrapper function
|
||||||
const session = await getServerAuthSession({ req, res });
|
const session = await getServerAuthSession({ req, res });
|
||||||
|
|
||||||
const apiKey = req.headers.authorization?.split(" ")[1] as string | null;
|
|
||||||
|
|
||||||
return createInnerTRPCContext({
|
return createInnerTRPCContext({
|
||||||
session,
|
session,
|
||||||
apiKey,
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "dotenv/config";
|
import "dotenv/config";
|
||||||
import { openApiDocument } from "~/pages/api/openapi.json";
|
import { openApiDocument } from "~/pages/api/v1/openapi.json";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
"info": {
|
"info": {
|
||||||
"title": "OpenPipe API",
|
"title": "OpenPipe API",
|
||||||
"description": "The public API for reporting API calls to OpenPipe",
|
"description": "The public API for reporting API calls to OpenPipe",
|
||||||
"version": "0.1.0"
|
"version": "0.1.1"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"url": "https://app.openpipe.ai/api"
|
"url": "https://app.openpipe.ai/api/v1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/v1/check-cache": {
|
"/check-cache": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "externalApi-checkCache",
|
"operationId": "checkCache",
|
||||||
"description": "Check if a prompt is cached",
|
"description": "Check if a prompt is cached",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
@@ -74,9 +74,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/v1/report": {
|
"/report": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "externalApi-report",
|
"operationId": "report",
|
||||||
"description": "Report an API call",
|
"description": "Report an API call",
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import httpx
|
|||||||
|
|
||||||
from ... import errors
|
from ... import errors
|
||||||
from ...client import AuthenticatedClient, Client
|
from ...client import AuthenticatedClient, Client
|
||||||
from ...models.external_api_report_json_body import ExternalApiReportJsonBody
|
from ...models.report_json_body import ReportJsonBody
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
def _get_kwargs(
|
def _get_kwargs(
|
||||||
*,
|
*,
|
||||||
json_body: ExternalApiReportJsonBody,
|
json_body: ReportJsonBody,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ def _get_kwargs(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"method": "post",
|
"method": "post",
|
||||||
"url": "/v1/report",
|
"url": "/report",
|
||||||
"json": json_json_body,
|
"json": json_json_body,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,12 +45,12 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiReportJsonBody,
|
json_body: ReportJsonBody,
|
||||||
) -> Response[Any]:
|
) -> Response[Any]:
|
||||||
"""Report an API call
|
"""Report an API call
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiReportJsonBody):
|
json_body (ReportJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
@@ -74,12 +74,12 @@ def sync_detailed(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiReportJsonBody,
|
json_body: ReportJsonBody,
|
||||||
) -> Response[Any]:
|
) -> Response[Any]:
|
||||||
"""Report an API call
|
"""Report an API call
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiReportJsonBody):
|
json_body (ReportJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
@@ -5,14 +5,14 @@ import httpx
|
|||||||
|
|
||||||
from ... import errors
|
from ... import errors
|
||||||
from ...client import AuthenticatedClient, Client
|
from ...client import AuthenticatedClient, Client
|
||||||
from ...models.external_api_check_cache_json_body import ExternalApiCheckCacheJsonBody
|
from ...models.check_cache_json_body import CheckCacheJsonBody
|
||||||
from ...models.external_api_check_cache_response_200 import ExternalApiCheckCacheResponse200
|
from ...models.check_cache_response_200 import CheckCacheResponse200
|
||||||
from ...types import Response
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
def _get_kwargs(
|
def _get_kwargs(
|
||||||
*,
|
*,
|
||||||
json_body: ExternalApiCheckCacheJsonBody,
|
json_body: CheckCacheJsonBody,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -20,16 +20,16 @@ def _get_kwargs(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"method": "post",
|
"method": "post",
|
||||||
"url": "/v1/check-cache",
|
"url": "/check-cache",
|
||||||
"json": json_json_body,
|
"json": json_json_body,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _parse_response(
|
def _parse_response(
|
||||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
) -> Optional[ExternalApiCheckCacheResponse200]:
|
) -> Optional[CheckCacheResponse200]:
|
||||||
if response.status_code == HTTPStatus.OK:
|
if response.status_code == HTTPStatus.OK:
|
||||||
response_200 = ExternalApiCheckCacheResponse200.from_dict(response.json())
|
response_200 = CheckCacheResponse200.from_dict(response.json())
|
||||||
|
|
||||||
return response_200
|
return response_200
|
||||||
if client.raise_on_unexpected_status:
|
if client.raise_on_unexpected_status:
|
||||||
@@ -40,7 +40,7 @@ def _parse_response(
|
|||||||
|
|
||||||
def _build_response(
|
def _build_response(
|
||||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||||
) -> Response[ExternalApiCheckCacheResponse200]:
|
) -> Response[CheckCacheResponse200]:
|
||||||
return Response(
|
return Response(
|
||||||
status_code=HTTPStatus(response.status_code),
|
status_code=HTTPStatus(response.status_code),
|
||||||
content=response.content,
|
content=response.content,
|
||||||
@@ -52,19 +52,19 @@ def _build_response(
|
|||||||
def sync_detailed(
|
def sync_detailed(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiCheckCacheJsonBody,
|
json_body: CheckCacheJsonBody,
|
||||||
) -> Response[ExternalApiCheckCacheResponse200]:
|
) -> Response[CheckCacheResponse200]:
|
||||||
"""Check if a prompt is cached
|
"""Check if a prompt is cached
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiCheckCacheJsonBody):
|
json_body (CheckCacheJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Response[ExternalApiCheckCacheResponse200]
|
Response[CheckCacheResponse200]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
@@ -81,19 +81,19 @@ def sync_detailed(
|
|||||||
def sync(
|
def sync(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiCheckCacheJsonBody,
|
json_body: CheckCacheJsonBody,
|
||||||
) -> Optional[ExternalApiCheckCacheResponse200]:
|
) -> Optional[CheckCacheResponse200]:
|
||||||
"""Check if a prompt is cached
|
"""Check if a prompt is cached
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiCheckCacheJsonBody):
|
json_body (CheckCacheJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
ExternalApiCheckCacheResponse200
|
CheckCacheResponse200
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return sync_detailed(
|
return sync_detailed(
|
||||||
@@ -105,19 +105,19 @@ def sync(
|
|||||||
async def asyncio_detailed(
|
async def asyncio_detailed(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiCheckCacheJsonBody,
|
json_body: CheckCacheJsonBody,
|
||||||
) -> Response[ExternalApiCheckCacheResponse200]:
|
) -> Response[CheckCacheResponse200]:
|
||||||
"""Check if a prompt is cached
|
"""Check if a prompt is cached
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiCheckCacheJsonBody):
|
json_body (CheckCacheJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Response[ExternalApiCheckCacheResponse200]
|
Response[CheckCacheResponse200]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
kwargs = _get_kwargs(
|
kwargs = _get_kwargs(
|
||||||
@@ -132,19 +132,19 @@ async def asyncio_detailed(
|
|||||||
async def asyncio(
|
async def asyncio(
|
||||||
*,
|
*,
|
||||||
client: AuthenticatedClient,
|
client: AuthenticatedClient,
|
||||||
json_body: ExternalApiCheckCacheJsonBody,
|
json_body: CheckCacheJsonBody,
|
||||||
) -> Optional[ExternalApiCheckCacheResponse200]:
|
) -> Optional[CheckCacheResponse200]:
|
||||||
"""Check if a prompt is cached
|
"""Check if a prompt is cached
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
json_body (ExternalApiCheckCacheJsonBody):
|
json_body (CheckCacheJsonBody):
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
ExternalApiCheckCacheResponse200
|
CheckCacheResponse200
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
""" Contains all the data models used in inputs/outputs """
|
""" Contains all the data models used in inputs/outputs """
|
||||||
|
|
||||||
from .external_api_check_cache_json_body import ExternalApiCheckCacheJsonBody
|
from .check_cache_json_body import CheckCacheJsonBody
|
||||||
from .external_api_check_cache_json_body_tags import ExternalApiCheckCacheJsonBodyTags
|
from .check_cache_json_body_tags import CheckCacheJsonBodyTags
|
||||||
from .external_api_check_cache_response_200 import ExternalApiCheckCacheResponse200
|
from .check_cache_response_200 import CheckCacheResponse200
|
||||||
from .external_api_report_json_body import ExternalApiReportJsonBody
|
from .report_json_body import ReportJsonBody
|
||||||
from .external_api_report_json_body_tags import ExternalApiReportJsonBodyTags
|
from .report_json_body_tags import ReportJsonBodyTags
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"ExternalApiCheckCacheJsonBody",
|
"CheckCacheJsonBody",
|
||||||
"ExternalApiCheckCacheJsonBodyTags",
|
"CheckCacheJsonBodyTags",
|
||||||
"ExternalApiCheckCacheResponse200",
|
"CheckCacheResponse200",
|
||||||
"ExternalApiReportJsonBody",
|
"ReportJsonBody",
|
||||||
"ExternalApiReportJsonBodyTags",
|
"ReportJsonBodyTags",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,25 +5,25 @@ from attrs import define
|
|||||||
from ..types import UNSET, Unset
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from ..models.external_api_check_cache_json_body_tags import ExternalApiCheckCacheJsonBodyTags
|
from ..models.check_cache_json_body_tags import CheckCacheJsonBodyTags
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T", bound="ExternalApiCheckCacheJsonBody")
|
T = TypeVar("T", bound="CheckCacheJsonBody")
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class ExternalApiCheckCacheJsonBody:
|
class CheckCacheJsonBody:
|
||||||
"""
|
"""
|
||||||
Attributes:
|
Attributes:
|
||||||
requested_at (float): Unix timestamp in milliseconds
|
requested_at (float): Unix timestamp in milliseconds
|
||||||
req_payload (Union[Unset, Any]): JSON-encoded request payload
|
req_payload (Union[Unset, Any]): JSON-encoded request payload
|
||||||
tags (Union[Unset, ExternalApiCheckCacheJsonBodyTags]): Extra tags to attach to the call for filtering. Eg {
|
tags (Union[Unset, CheckCacheJsonBodyTags]): Extra tags to attach to the call for filtering. Eg { "userId":
|
||||||
"userId": "123", "promptId": "populate-title" }
|
"123", "promptId": "populate-title" }
|
||||||
"""
|
"""
|
||||||
|
|
||||||
requested_at: float
|
requested_at: float
|
||||||
req_payload: Union[Unset, Any] = UNSET
|
req_payload: Union[Unset, Any] = UNSET
|
||||||
tags: Union[Unset, "ExternalApiCheckCacheJsonBodyTags"] = UNSET
|
tags: Union[Unset, "CheckCacheJsonBodyTags"] = UNSET
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, Any]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
requested_at = self.requested_at
|
requested_at = self.requested_at
|
||||||
@@ -47,7 +47,7 @@ class ExternalApiCheckCacheJsonBody:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||||
from ..models.external_api_check_cache_json_body_tags import ExternalApiCheckCacheJsonBodyTags
|
from ..models.check_cache_json_body_tags import CheckCacheJsonBodyTags
|
||||||
|
|
||||||
d = src_dict.copy()
|
d = src_dict.copy()
|
||||||
requested_at = d.pop("requestedAt")
|
requested_at = d.pop("requestedAt")
|
||||||
@@ -55,16 +55,16 @@ class ExternalApiCheckCacheJsonBody:
|
|||||||
req_payload = d.pop("reqPayload", UNSET)
|
req_payload = d.pop("reqPayload", UNSET)
|
||||||
|
|
||||||
_tags = d.pop("tags", UNSET)
|
_tags = d.pop("tags", UNSET)
|
||||||
tags: Union[Unset, ExternalApiCheckCacheJsonBodyTags]
|
tags: Union[Unset, CheckCacheJsonBodyTags]
|
||||||
if isinstance(_tags, Unset):
|
if isinstance(_tags, Unset):
|
||||||
tags = UNSET
|
tags = UNSET
|
||||||
else:
|
else:
|
||||||
tags = ExternalApiCheckCacheJsonBodyTags.from_dict(_tags)
|
tags = CheckCacheJsonBodyTags.from_dict(_tags)
|
||||||
|
|
||||||
external_api_check_cache_json_body = cls(
|
check_cache_json_body = cls(
|
||||||
requested_at=requested_at,
|
requested_at=requested_at,
|
||||||
req_payload=req_payload,
|
req_payload=req_payload,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
)
|
)
|
||||||
|
|
||||||
return external_api_check_cache_json_body
|
return check_cache_json_body
|
||||||
@@ -2,11 +2,11 @@ from typing import Any, Dict, List, Type, TypeVar
|
|||||||
|
|
||||||
from attrs import define, field
|
from attrs import define, field
|
||||||
|
|
||||||
T = TypeVar("T", bound="ExternalApiReportJsonBodyTags")
|
T = TypeVar("T", bound="CheckCacheJsonBodyTags")
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class ExternalApiReportJsonBodyTags:
|
class CheckCacheJsonBodyTags:
|
||||||
"""Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" }"""
|
"""Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" }"""
|
||||||
|
|
||||||
additional_properties: Dict[str, str] = field(init=False, factory=dict)
|
additional_properties: Dict[str, str] = field(init=False, factory=dict)
|
||||||
@@ -21,10 +21,10 @@ class ExternalApiReportJsonBodyTags:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||||
d = src_dict.copy()
|
d = src_dict.copy()
|
||||||
external_api_report_json_body_tags = cls()
|
check_cache_json_body_tags = cls()
|
||||||
|
|
||||||
external_api_report_json_body_tags.additional_properties = d
|
check_cache_json_body_tags.additional_properties = d
|
||||||
return external_api_report_json_body_tags
|
return check_cache_json_body_tags
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def additional_keys(self) -> List[str]:
|
def additional_keys(self) -> List[str]:
|
||||||
@@ -4,11 +4,11 @@ from attrs import define
|
|||||||
|
|
||||||
from ..types import UNSET, Unset
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
T = TypeVar("T", bound="ExternalApiCheckCacheResponse200")
|
T = TypeVar("T", bound="CheckCacheResponse200")
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class ExternalApiCheckCacheResponse200:
|
class CheckCacheResponse200:
|
||||||
"""
|
"""
|
||||||
Attributes:
|
Attributes:
|
||||||
resp_payload (Union[Unset, Any]): JSON-encoded response payload
|
resp_payload (Union[Unset, Any]): JSON-encoded response payload
|
||||||
@@ -31,8 +31,8 @@ class ExternalApiCheckCacheResponse200:
|
|||||||
d = src_dict.copy()
|
d = src_dict.copy()
|
||||||
resp_payload = d.pop("respPayload", UNSET)
|
resp_payload = d.pop("respPayload", UNSET)
|
||||||
|
|
||||||
external_api_check_cache_response_200 = cls(
|
check_cache_response_200 = cls(
|
||||||
resp_payload=resp_payload,
|
resp_payload=resp_payload,
|
||||||
)
|
)
|
||||||
|
|
||||||
return external_api_check_cache_response_200
|
return check_cache_response_200
|
||||||
@@ -5,14 +5,14 @@ from attrs import define
|
|||||||
from ..types import UNSET, Unset
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from ..models.external_api_report_json_body_tags import ExternalApiReportJsonBodyTags
|
from ..models.report_json_body_tags import ReportJsonBodyTags
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T", bound="ExternalApiReportJsonBody")
|
T = TypeVar("T", bound="ReportJsonBody")
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class ExternalApiReportJsonBody:
|
class ReportJsonBody:
|
||||||
"""
|
"""
|
||||||
Attributes:
|
Attributes:
|
||||||
requested_at (float): Unix timestamp in milliseconds
|
requested_at (float): Unix timestamp in milliseconds
|
||||||
@@ -21,8 +21,8 @@ class ExternalApiReportJsonBody:
|
|||||||
resp_payload (Union[Unset, Any]): JSON-encoded response payload
|
resp_payload (Union[Unset, Any]): JSON-encoded response payload
|
||||||
status_code (Union[Unset, float]): HTTP status code of response
|
status_code (Union[Unset, float]): HTTP status code of response
|
||||||
error_message (Union[Unset, str]): User-friendly error message
|
error_message (Union[Unset, str]): User-friendly error message
|
||||||
tags (Union[Unset, ExternalApiReportJsonBodyTags]): Extra tags to attach to the call for filtering. Eg {
|
tags (Union[Unset, ReportJsonBodyTags]): Extra tags to attach to the call for filtering. Eg { "userId": "123",
|
||||||
"userId": "123", "promptId": "populate-title" }
|
"promptId": "populate-title" }
|
||||||
"""
|
"""
|
||||||
|
|
||||||
requested_at: float
|
requested_at: float
|
||||||
@@ -31,7 +31,7 @@ class ExternalApiReportJsonBody:
|
|||||||
resp_payload: Union[Unset, Any] = UNSET
|
resp_payload: Union[Unset, Any] = UNSET
|
||||||
status_code: Union[Unset, float] = UNSET
|
status_code: Union[Unset, float] = UNSET
|
||||||
error_message: Union[Unset, str] = UNSET
|
error_message: Union[Unset, str] = UNSET
|
||||||
tags: Union[Unset, "ExternalApiReportJsonBodyTags"] = UNSET
|
tags: Union[Unset, "ReportJsonBodyTags"] = UNSET
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, Any]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
requested_at = self.requested_at
|
requested_at = self.requested_at
|
||||||
@@ -66,7 +66,7 @@ class ExternalApiReportJsonBody:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||||
from ..models.external_api_report_json_body_tags import ExternalApiReportJsonBodyTags
|
from ..models.report_json_body_tags import ReportJsonBodyTags
|
||||||
|
|
||||||
d = src_dict.copy()
|
d = src_dict.copy()
|
||||||
requested_at = d.pop("requestedAt")
|
requested_at = d.pop("requestedAt")
|
||||||
@@ -82,13 +82,13 @@ class ExternalApiReportJsonBody:
|
|||||||
error_message = d.pop("errorMessage", UNSET)
|
error_message = d.pop("errorMessage", UNSET)
|
||||||
|
|
||||||
_tags = d.pop("tags", UNSET)
|
_tags = d.pop("tags", UNSET)
|
||||||
tags: Union[Unset, ExternalApiReportJsonBodyTags]
|
tags: Union[Unset, ReportJsonBodyTags]
|
||||||
if isinstance(_tags, Unset):
|
if isinstance(_tags, Unset):
|
||||||
tags = UNSET
|
tags = UNSET
|
||||||
else:
|
else:
|
||||||
tags = ExternalApiReportJsonBodyTags.from_dict(_tags)
|
tags = ReportJsonBodyTags.from_dict(_tags)
|
||||||
|
|
||||||
external_api_report_json_body = cls(
|
report_json_body = cls(
|
||||||
requested_at=requested_at,
|
requested_at=requested_at,
|
||||||
received_at=received_at,
|
received_at=received_at,
|
||||||
req_payload=req_payload,
|
req_payload=req_payload,
|
||||||
@@ -98,4 +98,4 @@ class ExternalApiReportJsonBody:
|
|||||||
tags=tags,
|
tags=tags,
|
||||||
)
|
)
|
||||||
|
|
||||||
return external_api_report_json_body
|
return report_json_body
|
||||||
@@ -2,11 +2,11 @@ from typing import Any, Dict, List, Type, TypeVar
|
|||||||
|
|
||||||
from attrs import define, field
|
from attrs import define, field
|
||||||
|
|
||||||
T = TypeVar("T", bound="ExternalApiCheckCacheJsonBodyTags")
|
T = TypeVar("T", bound="ReportJsonBodyTags")
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class ExternalApiCheckCacheJsonBodyTags:
|
class ReportJsonBodyTags:
|
||||||
"""Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" }"""
|
"""Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" }"""
|
||||||
|
|
||||||
additional_properties: Dict[str, str] = field(init=False, factory=dict)
|
additional_properties: Dict[str, str] = field(init=False, factory=dict)
|
||||||
@@ -21,10 +21,10 @@ class ExternalApiCheckCacheJsonBodyTags:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||||
d = src_dict.copy()
|
d = src_dict.copy()
|
||||||
external_api_check_cache_json_body_tags = cls()
|
report_json_body_tags = cls()
|
||||||
|
|
||||||
external_api_check_cache_json_body_tags.additional_properties = d
|
report_json_body_tags.additional_properties = d
|
||||||
return external_api_check_cache_json_body_tags
|
return report_json_body_tags
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def additional_keys(self) -> List[str]:
|
def additional_keys(self) -> List[str]:
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
from openpipe.api_client.api.default import (
|
from openpipe.api_client.api.default import (
|
||||||
external_api_report,
|
api_report,
|
||||||
external_api_check_cache,
|
check_cache,
|
||||||
)
|
)
|
||||||
from openpipe.api_client.client import AuthenticatedClient
|
from openpipe.api_client.client import AuthenticatedClient
|
||||||
from openpipe.api_client.models.external_api_report_json_body_tags import (
|
from openpipe.api_client.models.report_json_body_tags import (
|
||||||
ExternalApiReportJsonBodyTags,
|
ReportJsonBodyTags,
|
||||||
)
|
)
|
||||||
import toml
|
import toml
|
||||||
import time
|
import time
|
||||||
@@ -21,7 +21,7 @@ def _get_tags(openpipe_options):
|
|||||||
tags["$sdk"] = "python"
|
tags["$sdk"] = "python"
|
||||||
tags["$sdk_version"] = version
|
tags["$sdk_version"] = version
|
||||||
|
|
||||||
return ExternalApiReportJsonBodyTags.from_dict(tags)
|
return ReportJsonBodyTags.from_dict(tags)
|
||||||
|
|
||||||
|
|
||||||
def _should_check_cache(openpipe_options):
|
def _should_check_cache(openpipe_options):
|
||||||
@@ -31,7 +31,7 @@ def _should_check_cache(openpipe_options):
|
|||||||
|
|
||||||
|
|
||||||
def _process_cache_payload(
|
def _process_cache_payload(
|
||||||
payload: external_api_check_cache.ExternalApiCheckCacheResponse200,
|
payload: check_cache.CheckCacheResponse200,
|
||||||
):
|
):
|
||||||
if not payload or not payload.resp_payload:
|
if not payload or not payload.resp_payload:
|
||||||
return None
|
return None
|
||||||
@@ -47,9 +47,9 @@ def maybe_check_cache(
|
|||||||
if not _should_check_cache(openpipe_options):
|
if not _should_check_cache(openpipe_options):
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
payload = external_api_check_cache.sync(
|
payload = check_cache.sync(
|
||||||
client=configured_client,
|
client=configured_client,
|
||||||
json_body=external_api_check_cache.ExternalApiCheckCacheJsonBody(
|
json_body=check_cache.CheckCacheJsonBody(
|
||||||
req_payload=req_payload,
|
req_payload=req_payload,
|
||||||
requested_at=int(time.time() * 1000),
|
requested_at=int(time.time() * 1000),
|
||||||
tags=_get_tags(openpipe_options),
|
tags=_get_tags(openpipe_options),
|
||||||
@@ -72,9 +72,9 @@ async def maybe_check_cache_async(
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
payload = await external_api_check_cache.asyncio(
|
payload = await check_cache.asyncio(
|
||||||
client=configured_client,
|
client=configured_client,
|
||||||
json_body=external_api_check_cache.ExternalApiCheckCacheJsonBody(
|
json_body=check_cache.CheckCacheJsonBody(
|
||||||
req_payload=req_payload,
|
req_payload=req_payload,
|
||||||
requested_at=int(time.time() * 1000),
|
requested_at=int(time.time() * 1000),
|
||||||
tags=_get_tags(openpipe_options),
|
tags=_get_tags(openpipe_options),
|
||||||
@@ -94,9 +94,9 @@ def report(
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
external_api_report.sync_detailed(
|
api_report.sync_detailed(
|
||||||
client=configured_client,
|
client=configured_client,
|
||||||
json_body=external_api_report.ExternalApiReportJsonBody(
|
json_body=api_report.ReportJsonBody(
|
||||||
**kwargs,
|
**kwargs,
|
||||||
tags=_get_tags(openpipe_options),
|
tags=_get_tags(openpipe_options),
|
||||||
),
|
),
|
||||||
@@ -112,9 +112,9 @@ async def report_async(
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
await external_api_report.asyncio_detailed(
|
await api_report.asyncio_detailed(
|
||||||
client=configured_client,
|
client=configured_client,
|
||||||
json_body=external_api_report.ExternalApiReportJsonBody(
|
json_body=api_report.ReportJsonBody(
|
||||||
**kwargs,
|
**kwargs,
|
||||||
tags=_get_tags(openpipe_options),
|
tags=_get_tags(openpipe_options),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* OpenPipe API
|
* OpenPipe API
|
||||||
* The public API for reporting API calls to OpenPipe
|
* The public API for reporting API calls to OpenPipe
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 0.1.0
|
* The version of the OpenAPI document: 0.1.1
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
@@ -26,125 +26,125 @@ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base';
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ExternalApiCheckCache200Response
|
* @interface CheckCache200Response
|
||||||
*/
|
*/
|
||||||
export interface ExternalApiCheckCache200Response {
|
export interface CheckCache200Response {
|
||||||
/**
|
/**
|
||||||
* JSON-encoded response payload
|
* JSON-encoded response payload
|
||||||
* @type {any}
|
* @type {any}
|
||||||
* @memberof ExternalApiCheckCache200Response
|
* @memberof CheckCache200Response
|
||||||
*/
|
*/
|
||||||
'respPayload'?: any;
|
'respPayload'?: any;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ExternalApiCheckCacheDefaultResponse
|
* @interface CheckCacheDefaultResponse
|
||||||
*/
|
*/
|
||||||
export interface ExternalApiCheckCacheDefaultResponse {
|
export interface CheckCacheDefaultResponse {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ExternalApiCheckCacheDefaultResponse
|
* @memberof CheckCacheDefaultResponse
|
||||||
*/
|
*/
|
||||||
'message': string;
|
'message': string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ExternalApiCheckCacheDefaultResponse
|
* @memberof CheckCacheDefaultResponse
|
||||||
*/
|
*/
|
||||||
'code': string;
|
'code': string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {Array<ExternalApiCheckCacheDefaultResponseIssuesInner>}
|
* @type {Array<CheckCacheDefaultResponseIssuesInner>}
|
||||||
* @memberof ExternalApiCheckCacheDefaultResponse
|
* @memberof CheckCacheDefaultResponse
|
||||||
*/
|
*/
|
||||||
'issues'?: Array<ExternalApiCheckCacheDefaultResponseIssuesInner>;
|
'issues'?: Array<CheckCacheDefaultResponseIssuesInner>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ExternalApiCheckCacheDefaultResponseIssuesInner
|
* @interface CheckCacheDefaultResponseIssuesInner
|
||||||
*/
|
*/
|
||||||
export interface ExternalApiCheckCacheDefaultResponseIssuesInner {
|
export interface CheckCacheDefaultResponseIssuesInner {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ExternalApiCheckCacheDefaultResponseIssuesInner
|
* @memberof CheckCacheDefaultResponseIssuesInner
|
||||||
*/
|
*/
|
||||||
'message': string;
|
'message': string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ExternalApiCheckCacheRequest
|
* @interface CheckCacheRequest
|
||||||
*/
|
*/
|
||||||
export interface ExternalApiCheckCacheRequest {
|
export interface CheckCacheRequest {
|
||||||
/**
|
/**
|
||||||
* Unix timestamp in milliseconds
|
* Unix timestamp in milliseconds
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @memberof ExternalApiCheckCacheRequest
|
* @memberof CheckCacheRequest
|
||||||
*/
|
*/
|
||||||
'requestedAt': number;
|
'requestedAt': number;
|
||||||
/**
|
/**
|
||||||
* JSON-encoded request payload
|
* JSON-encoded request payload
|
||||||
* @type {any}
|
* @type {any}
|
||||||
* @memberof ExternalApiCheckCacheRequest
|
* @memberof CheckCacheRequest
|
||||||
*/
|
*/
|
||||||
'reqPayload'?: any;
|
'reqPayload'?: any;
|
||||||
/**
|
/**
|
||||||
* Extra tags to attach to the call for filtering. Eg { \"userId\": \"123\", \"promptId\": \"populate-title\" }
|
* Extra tags to attach to the call for filtering. Eg { \"userId\": \"123\", \"promptId\": \"populate-title\" }
|
||||||
* @type {{ [key: string]: string; }}
|
* @type {{ [key: string]: string; }}
|
||||||
* @memberof ExternalApiCheckCacheRequest
|
* @memberof CheckCacheRequest
|
||||||
*/
|
*/
|
||||||
'tags'?: { [key: string]: string; };
|
'tags'?: { [key: string]: string; };
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface ExternalApiReportRequest
|
* @interface ReportRequest
|
||||||
*/
|
*/
|
||||||
export interface ExternalApiReportRequest {
|
export interface ReportRequest {
|
||||||
/**
|
/**
|
||||||
* Unix timestamp in milliseconds
|
* Unix timestamp in milliseconds
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'requestedAt': number;
|
'requestedAt': number;
|
||||||
/**
|
/**
|
||||||
* Unix timestamp in milliseconds
|
* Unix timestamp in milliseconds
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'receivedAt': number;
|
'receivedAt': number;
|
||||||
/**
|
/**
|
||||||
* JSON-encoded request payload
|
* JSON-encoded request payload
|
||||||
* @type {any}
|
* @type {any}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'reqPayload'?: any;
|
'reqPayload'?: any;
|
||||||
/**
|
/**
|
||||||
* JSON-encoded response payload
|
* JSON-encoded response payload
|
||||||
* @type {any}
|
* @type {any}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'respPayload'?: any;
|
'respPayload'?: any;
|
||||||
/**
|
/**
|
||||||
* HTTP status code of response
|
* HTTP status code of response
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'statusCode'?: number;
|
'statusCode'?: number;
|
||||||
/**
|
/**
|
||||||
* User-friendly error message
|
* User-friendly error message
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'errorMessage'?: string;
|
'errorMessage'?: string;
|
||||||
/**
|
/**
|
||||||
* Extra tags to attach to the call for filtering. Eg { \"userId\": \"123\", \"promptId\": \"populate-title\" }
|
* Extra tags to attach to the call for filtering. Eg { \"userId\": \"123\", \"promptId\": \"populate-title\" }
|
||||||
* @type {{ [key: string]: string; }}
|
* @type {{ [key: string]: string; }}
|
||||||
* @memberof ExternalApiReportRequest
|
* @memberof ReportRequest
|
||||||
*/
|
*/
|
||||||
'tags'?: { [key: string]: string; };
|
'tags'?: { [key: string]: string; };
|
||||||
}
|
}
|
||||||
@@ -157,14 +157,14 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Check if a prompt is cached
|
* Check if a prompt is cached
|
||||||
* @param {ExternalApiCheckCacheRequest} externalApiCheckCacheRequest
|
* @param {CheckCacheRequest} checkCacheRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
externalApiCheckCache: async (externalApiCheckCacheRequest: ExternalApiCheckCacheRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
checkCache: async (checkCacheRequest: CheckCacheRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'externalApiCheckCacheRequest' is not null or undefined
|
// verify required parameter 'checkCacheRequest' is not null or undefined
|
||||||
assertParamExists('externalApiCheckCache', 'externalApiCheckCacheRequest', externalApiCheckCacheRequest)
|
assertParamExists('checkCache', 'checkCacheRequest', checkCacheRequest)
|
||||||
const localVarPath = `/v1/check-cache`;
|
const localVarPath = `/check-cache`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
@@ -187,7 +187,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded(externalApiCheckCacheRequest, localVarRequestOptions, configuration)
|
localVarRequestOptions.data = serializeDataIfNeeded(checkCacheRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: toPathString(localVarUrlObj),
|
url: toPathString(localVarUrlObj),
|
||||||
@@ -196,14 +196,14 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Report an API call
|
* Report an API call
|
||||||
* @param {ExternalApiReportRequest} externalApiReportRequest
|
* @param {ReportRequest} reportRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
externalApiReport: async (externalApiReportRequest: ExternalApiReportRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
report: async (reportRequest: ReportRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'externalApiReportRequest' is not null or undefined
|
// verify required parameter 'reportRequest' is not null or undefined
|
||||||
assertParamExists('externalApiReport', 'externalApiReportRequest', externalApiReportRequest)
|
assertParamExists('report', 'reportRequest', reportRequest)
|
||||||
const localVarPath = `/v1/report`;
|
const localVarPath = `/report`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
@@ -226,7 +226,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded(externalApiReportRequest, localVarRequestOptions, configuration)
|
localVarRequestOptions.data = serializeDataIfNeeded(reportRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: toPathString(localVarUrlObj),
|
url: toPathString(localVarUrlObj),
|
||||||
@@ -245,22 +245,22 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Check if a prompt is cached
|
* Check if a prompt is cached
|
||||||
* @param {ExternalApiCheckCacheRequest} externalApiCheckCacheRequest
|
* @param {CheckCacheRequest} checkCacheRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async externalApiCheckCache(externalApiCheckCacheRequest: ExternalApiCheckCacheRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ExternalApiCheckCache200Response>> {
|
async checkCache(checkCacheRequest: CheckCacheRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CheckCache200Response>> {
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.externalApiCheckCache(externalApiCheckCacheRequest, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.checkCache(checkCacheRequest, options);
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Report an API call
|
* Report an API call
|
||||||
* @param {ExternalApiReportRequest} externalApiReportRequest
|
* @param {ReportRequest} reportRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async externalApiReport(externalApiReportRequest: ExternalApiReportRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
|
async report(reportRequest: ReportRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.externalApiReport(externalApiReportRequest, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.report(reportRequest, options);
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -275,21 +275,21 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Check if a prompt is cached
|
* Check if a prompt is cached
|
||||||
* @param {ExternalApiCheckCacheRequest} externalApiCheckCacheRequest
|
* @param {CheckCacheRequest} checkCacheRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
externalApiCheckCache(externalApiCheckCacheRequest: ExternalApiCheckCacheRequest, options?: any): AxiosPromise<ExternalApiCheckCache200Response> {
|
checkCache(checkCacheRequest: CheckCacheRequest, options?: any): AxiosPromise<CheckCache200Response> {
|
||||||
return localVarFp.externalApiCheckCache(externalApiCheckCacheRequest, options).then((request) => request(axios, basePath));
|
return localVarFp.checkCache(checkCacheRequest, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Report an API call
|
* Report an API call
|
||||||
* @param {ExternalApiReportRequest} externalApiReportRequest
|
* @param {ReportRequest} reportRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
externalApiReport(externalApiReportRequest: ExternalApiReportRequest, options?: any): AxiosPromise<any> {
|
report(reportRequest: ReportRequest, options?: any): AxiosPromise<any> {
|
||||||
return localVarFp.externalApiReport(externalApiReportRequest, options).then((request) => request(axios, basePath));
|
return localVarFp.report(reportRequest, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -303,24 +303,24 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|||||||
export class DefaultApi extends BaseAPI {
|
export class DefaultApi extends BaseAPI {
|
||||||
/**
|
/**
|
||||||
* Check if a prompt is cached
|
* Check if a prompt is cached
|
||||||
* @param {ExternalApiCheckCacheRequest} externalApiCheckCacheRequest
|
* @param {CheckCacheRequest} checkCacheRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @memberof DefaultApi
|
* @memberof DefaultApi
|
||||||
*/
|
*/
|
||||||
public externalApiCheckCache(externalApiCheckCacheRequest: ExternalApiCheckCacheRequest, options?: AxiosRequestConfig) {
|
public checkCache(checkCacheRequest: CheckCacheRequest, options?: AxiosRequestConfig) {
|
||||||
return DefaultApiFp(this.configuration).externalApiCheckCache(externalApiCheckCacheRequest, options).then((request) => request(this.axios, this.basePath));
|
return DefaultApiFp(this.configuration).checkCache(checkCacheRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report an API call
|
* Report an API call
|
||||||
* @param {ExternalApiReportRequest} externalApiReportRequest
|
* @param {ReportRequest} reportRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @memberof DefaultApi
|
* @memberof DefaultApi
|
||||||
*/
|
*/
|
||||||
public externalApiReport(externalApiReportRequest: ExternalApiReportRequest, options?: AxiosRequestConfig) {
|
public report(reportRequest: ReportRequest, options?: AxiosRequestConfig) {
|
||||||
return DefaultApiFp(this.configuration).externalApiReport(externalApiReportRequest, options).then((request) => request(this.axios, this.basePath));
|
return DefaultApiFp(this.configuration).report(reportRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* OpenPipe API
|
* OpenPipe API
|
||||||
* The public API for reporting API calls to OpenPipe
|
* The public API for reporting API calls to OpenPipe
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 0.1.0
|
* The version of the OpenAPI document: 0.1.1
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
@@ -19,7 +19,7 @@ import type { Configuration } from './configuration';
|
|||||||
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||||
import globalAxios from 'axios';
|
import globalAxios from 'axios';
|
||||||
|
|
||||||
export const BASE_PATH = "https://app.openpipe.ai/api".replace(/\/+$/, "");
|
export const BASE_PATH = "https://app.openpipe.ai/api/v1".replace(/\/+$/, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* OpenPipe API
|
* OpenPipe API
|
||||||
* The public API for reporting API calls to OpenPipe
|
* The public API for reporting API calls to OpenPipe
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 0.1.0
|
* The version of the OpenAPI document: 0.1.1
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* OpenPipe API
|
* OpenPipe API
|
||||||
* The public API for reporting API calls to OpenPipe
|
* The public API for reporting API calls to OpenPipe
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 0.1.0
|
* The version of the OpenAPI document: 0.1.1
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* OpenPipe API
|
* OpenPipe API
|
||||||
* The public API for reporting API calls to OpenPipe
|
* The public API for reporting API calls to OpenPipe
|
||||||
*
|
*
|
||||||
* The version of the OpenAPI document: 0.1.0
|
* The version of the OpenAPI document: 0.1.1
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
|||||||
Reference in New Issue
Block a user