diff --git a/apps/server/scripts/generate-openapi-spec-json.ts b/apps/server/scripts/generate-openapi-spec-json.ts index c5fd4404..5842b25a 100644 --- a/apps/server/scripts/generate-openapi-spec-json.ts +++ b/apps/server/scripts/generate-openapi-spec-json.ts @@ -17,9 +17,9 @@ export default async function generateOpenAPISchemaJSON() { .build(); const document = SwaggerModule.createDocument(app, config); const outputPath = path.join(__dirname, "../../../docs/"); - const outputFilePath = path.join(outputPath, "open-api-spec.json"); - fs.writeFileSync(outputFilePath, JSON.stringify(document, null, 2)); - console.log("Generated swagger file"); + const outputFilePath = path.join(outputPath, "openapi.json"); + fs.writeFileSync(outputFilePath, JSON.stringify(document)); + console.log("Generated OpenAPI spec"); process.exit(0); } diff --git a/docs/api-reference/cache/retrieve-cached-request.mdx b/docs/api-reference/cache/retrieve-cached-request.mdx index 4a4c427c..22fcf480 100644 --- a/docs/api-reference/cache/retrieve-cached-request.mdx +++ b/docs/api-reference/cache/retrieve-cached-request.mdx @@ -1,3 +1,3 @@ --- -openapi: post /api/cache/v1/request/retrieve +openapi: post /cache/v1/request/retrieve --- \ No newline at end of file diff --git a/docs/api-reference/cache/save-request-to-cache.mdx b/docs/api-reference/cache/save-request-to-cache.mdx index 57d80bd7..de13e36d 100644 --- a/docs/api-reference/cache/save-request-to-cache.mdx +++ b/docs/api-reference/cache/save-request-to-cache.mdx @@ -1,3 +1,3 @@ --- -openapi: post /api/cache/v1/request/save +openapi: post /cache/v1/request/save --- \ No newline at end of file diff --git a/docs/api-reference/health/performs-a-health-check.mdx b/docs/api-reference/health/performs-a-health-check.mdx index 351b9733..4cd1d03a 100644 --- a/docs/api-reference/health/performs-a-health-check.mdx +++ b/docs/api-reference/health/performs-a-health-check.mdx @@ -1,3 +1,3 @@ --- -openapi: get /api/healthz +openapi: get /healthz --- \ No newline at end of file diff --git a/docs/api-reference/prompts/get-the-deployed-prompt-version-to-a-particular-environment.mdx b/docs/api-reference/prompts/get-the-deployed-prompt-version-to-a-particular-environment.mdx index d300f366..b2335cd6 100644 --- a/docs/api-reference/prompts/get-the-deployed-prompt-version-to-a-particular-environment.mdx +++ b/docs/api-reference/prompts/get-the-deployed-prompt-version-to-a-particular-environment.mdx @@ -1,3 +1,3 @@ --- -openapi: get /api/prompts/v2/deployment +openapi: get /prompts/v2/deployment --- \ No newline at end of file diff --git a/docs/api-reference/reporting/report-a-request.mdx b/docs/api-reference/reporting/report-a-request.mdx index 3cab7d0f..22674a4e 100644 --- a/docs/api-reference/reporting/report-a-request.mdx +++ b/docs/api-reference/reporting/report-a-request.mdx @@ -1,3 +1,3 @@ --- -openapi: post /api/reporting/v2/request +openapi: post /reporting/v2/request --- \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index 261e8948..5c180c67 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -106,10 +106,10 @@ } }, "api": { - "baseUrl": "https://api.staging.pezzo.ai", + "baseUrl": "https://api.staging.pezzo.ai/api", "playground": { "mode": "hide" } }, - "openapi": "https://api.staging.pezzo.ai/api/spec-json" + "openapi": "./openapi.json" } diff --git a/docs/openapi.json b/docs/openapi.json new file mode 100644 index 00000000..bbdd7072 --- /dev/null +++ b/docs/openapi.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","paths":{"/healthz":{"get":{"operationId":"HealthController_healthz","summary":"Performs a health check","parameters":[],"responses":{"200":{"description":"Returns the health status and current version"}},"tags":["Health"]}},"/prompts/v2/deployment":{"get":{"operationId":"PromptsController_getPromptDeployment","summary":"Get the deployed Prompt Version to a particular Environment","parameters":[{"name":"name","required":true,"in":"query","description":"The name of the prompt (case sensitive)","example":"PromptName","schema":{"type":"string"}},{"name":"environmentName","required":true,"in":"query","description":"The name of the environment (case sensitive)","example":"Production","schema":{"type":"string"}}],"responses":{"200":{"description":"Deployed prompt version object"},"404":{"description":"Prompt deployment not found for the specific environment name"},"500":{"description":"Internal server error"}},"tags":["Prompts"]}},"/reporting/v2/request":{"post":{"operationId":"ReportingController_reportRequest","summary":"Report a request","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReportDto"}}}},"responses":{"200":{"description":"Report has been reported successfully"},"500":{"description":"Internal server error"}},"tags":["Reporting"]}},"/cache/v1/request/retrieve":{"post":{"operationId":"CacheController_retrieveCachedRequest","summary":"Retrieve cached request","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetrieveCacheRequestDto"}}}},"responses":{"200":{"description":"Returns the cached request data."},"404":{"description":"Cached request not found."}},"tags":["Cache"]}},"/cache/v1/request/save":{"post":{"operationId":"CacheController_saveRequestToCache","summary":"Save request to cache","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRequestDto"}}}},"responses":{"200":{"description":"Returns the cache request result."}},"tags":["Cache"]}}},"info":{"title":"Pezzo API","description":"Specification of the Pezzo REST API, used by various clients.","version":"1.0","contact":{}},"tags":[],"servers":[],"components":{"schemas":{"PromptExecutionMetadataDto":{"type":"object","properties":{"provider":{"type":"string","description":"LLM provider","enum":["OpenAI","Azure","Anthropic"]},"client":{"type":"string","description":"Client name identifier","example":"pezzo-ts"},"clientVersion":{"type":"string","description":"Client version","example":"0.4.11"},"environment":{"type":"string","description":"The name of the Environment (case sensitive)","example":"Production"},"promptId":{"type":"string","description":"The ID of the reported prompt (if managed)","example":"c41jd0s93j000ud7kg7vekhi3"}},"required":["provider","client","clientVersion","environment"]},"ExecutionRequestDto":{"type":"object","properties":{"timestamp":{"format":"date-time","type":"string","description":"Request timestamp","example":"2021-01-01T00:00:00.000Z"},"body":{"type":"object","description":"Raw request body, as sent to the LLM","additionalProperties":true}},"required":["timestamp","body"]},"ExecutionResponseDto":{"type":"object","properties":{"timestamp":{"format":"date-time","type":"string","description":"Response timestamp","example":"2021-01-01T00:00:00.000Z"},"body":{"type":"object","description":"Raw response body, as received from the LLM","additionalProperties":true}},"required":["timestamp","body"]},"CreateReportDto":{"type":"object","properties":{"metadata":{"description":"Metadata","allOf":[{"$ref":"#/components/schemas/PromptExecutionMetadataDto"}]},"properties":{"type":"object","description":"Additional properties to be associated with the report","additionalProperties":true,"example":{"userId":"someUserId","traceId":"traceId"}},"request":{"$ref":"#/components/schemas/ExecutionRequestDto"},"response":{"$ref":"#/components/schemas/ExecutionResponseDto"},"cacheEnabled":{"type":"boolean","description":"Whether caching is enabled for the report","default":false},"cacheHit":{"type":"boolean","description":"Whether the report was generated from a cache hit or not","default":false}},"required":["metadata","request","response"]},"RetrieveCacheRequestDto":{"type":"object","properties":{"request":{"type":"object","description":"The request object to retrieve from cache","additionalProperties":true,"example":{"key1":"value1","key2":"value2"}}},"required":["request"]},"CacheRequestDto":{"type":"object","properties":{"request":{"type":"object","description":"The request object to cache","additionalProperties":true,"example":{"key1":"value1","key2":"value2"}},"response":{"type":"object","description":"The response object to cache","additionalProperties":true,"example":{"key1":"value1","key2":"value2"}}},"required":["request","response"]}}}} \ No newline at end of file