Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1572 bewiki create huggingface repository apiv1resourcesgenerate description endpoint and testing #1573

Merged
7 changes: 7 additions & 0 deletions services/wiki/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ DB_PASS=123456
DB_PORT=10911
DB_USER=postgres
DB_SCHEMA=public

HF_API_ENDPOINT="https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct"
HF_API_KEY=your_huggingface_api_key
HF_RES_MAX_LENGTH=350
HF_RES_TEMP=0.75
HF_RES_TOP_P=0.95
HF_MODEL="Qwen2.5-Coder-32B-Instruct"
86 changes: 86 additions & 0 deletions services/wiki/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,92 @@ paths:
- $ref: "#/components/schemas/MissingTokenError"
"404":
description: Not found
/api/v1/resources/generate-description:
post:
tags:
- resources
operationId: postResourcesGenerateDescription
description: Allows an authenticated user to generate a description for a
resource. Requires language as a query parameter and title, url, and
topic in the request body.
summary: Generates a description for a resource
security:
- cookieAuth: []
parameters:
- in: query
name: language
schema:
type: string
minLength: 2
maxLength: 2
example: es
required: false
requestBody:
content:
application/json:
schema:
type: object
properties:
url:
type: string
format: uri
example: https://tutorials.cat/learn/javascript
title:
type: string
example: My Resource in Javascript
required:
- url
- title
responses:
"200":
description: A description for the resource is generated.
content:
application/json:
schema:
type: object
properties:
description:
type: string
required:
- description
"400":
description: Error fetching data from external API
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: Error fetching data from external API
required:
- error
"401":
description: Invalid token
content:
application/json:
schema:
anyOf:
- $ref: "#/components/schemas/InvalidTokenError"
- $ref: "#/components/schemas/MissingTokenError"
"422":
description: Missing required parameters
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
"500":
description: An error occured while getting the description
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: An error occured while getting the description
required:
- message
"/api/v1/seen/{resourceId}":
post:
tags:
Expand Down
Loading
Loading