# Prompts

## Upsert

> Upsert a prompt entry.\
> \
> Creates a new prompt if the provided \`id\` does not exist, or updates\
> the existing prompt with the given \`id\`.\
> \
> Args:\
> &#x20;   request (Prompt): The prompt data to insert or update.\
> &#x20;   db (AsyncSession): The database session dependency.\
> \
> Returns:\
> &#x20;   JSONResponse: A JSON response containing the prompt data that was upserted.\
> \
> Raises:\
> &#x20;   HTTPException: If the operation encounters an unexpected error (not currently implemented,\
> &#x20;               but can be added for error handling).\
> \
> Notes:\
> &#x20;   \- Uses FastCRUD for abstracted DB operations.\
> &#x20;   \- Relies on the \`id\` field to determine insert vs update.

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"Prompt":{"properties":{"id":{"type":"integer","title":"Id"},"codename":{"type":"string","title":"Codename"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"variables":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variables"}},"type":"object","required":["id","codename","title","value","variables"],"title":"Prompt","description":"Prompt model."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts/upsert":{"post":{"tags":["Prompts"],"summary":"Upsert","description":"Upsert a prompt entry.\n\nCreates a new prompt if the provided `id` does not exist, or updates\nthe existing prompt with the given `id`.\n\nArgs:\n    request (Prompt): The prompt data to insert or update.\n    db (AsyncSession): The database session dependency.\n\nReturns:\n    JSONResponse: A JSON response containing the prompt data that was upserted.\n\nRaises:\n    HTTPException: If the operation encounters an unexpected error (not currently implemented,\n                but can be added for error handling).\n\nNotes:\n    - Uses FastCRUD for abstracted DB operations.\n    - Relies on the `id` field to determine insert vs update.","operationId":"upsert_prompts_upsert_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prompt"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get

> Read multiple PromptModel rows from the database.\
> \
> \- Use page & itemsPerPage for paginated results\
> \- Use offset & limit for specific ranges\
> \- Returns paginated response when using page/itemsPerPage\
> \- Returns simple list response when using offset/limit

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"fastcrud__paginated__schemas__DynamicPaginatedResponse__3":{"properties":{"data":{"items":{"$ref":"#/components/schemas/Prompt"},"type":"array","title":"Data"},"total_count":{"type":"integer","title":"Total Count"},"has_more":{"type":"boolean","title":"Has More"},"page":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page"},"items_per_page":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Items Per Page"}},"type":"object","required":["data","total_count","has_more"],"title":"DynamicPaginatedResponse"},"Prompt":{"properties":{"id":{"type":"integer","title":"Id"},"codename":{"type":"string","title":"Codename"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"variables":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variables"}},"type":"object","required":["id","codename","title","value","variables"],"title":"Prompt","description":"Prompt model."},"fastcrud__paginated__schemas__DynamicListResponse__3":{"properties":{"data":{"items":{"$ref":"#/components/schemas/Prompt"},"type":"array","title":"Data"}},"type":"object","required":["data"],"title":"DynamicListResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts":{"get":{"tags":["Prompts"],"summary":"Get","description":"Read multiple PromptModel rows from the database.\n\n- Use page & itemsPerPage for paginated results\n- Use offset & limit for specific ranges\n- Returns paginated response when using page/itemsPerPage\n- Returns simple list response when using offset/limit","operationId":"endpoint_prompts_get","parameters":[{"name":"offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Offset for unpaginated queries","title":"Offset"},"description":"Offset for unpaginated queries"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Limit for unpaginated queries","title":"Limit"},"description":"Limit for unpaginated queries"},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Page number","title":"Page"},"description":"Page number"},{"name":"itemsPerPage","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of items per page","title":"Itemsperpage"},"description":"Number of items per page"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/fastcrud__paginated__schemas__DynamicPaginatedResponse__3"},{"$ref":"#/components/schemas/fastcrud__paginated__schemas__DynamicListResponse__3"}],"title":"Response Endpoint Prompts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create

> Create a new PromptModel row in the database.

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"CreatePrompt":{"properties":{"codename":{"type":"string","title":"Codename"},"title":{"type":"string","title":"Title"},"value":{"type":"string","title":"Value"},"variables":{"type":"string","title":"Variables"}},"type":"object","required":["codename","title","value","variables"],"title":"CreatePrompt","description":"Create Prompt model."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts":{"post":{"tags":["Prompts"],"summary":"Create","description":"Create a new PromptModel row in the database.","operationId":"endpoint_prompts_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePrompt"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get

> Read a single PromptModel row from the database by its primary keys: \['id'].

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"Prompt":{"properties":{"id":{"type":"integer","title":"Id"},"codename":{"type":"string","title":"Codename"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"variables":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variables"}},"type":"object","required":["id","codename","title","value","variables"],"title":"Prompt","description":"Prompt model."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts/{id}":{"get":{"tags":["Prompts"],"summary":"Get","description":"Read a single PromptModel row from the database by its primary keys: ['id'].","operationId":"endpoint_prompts__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prompt"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete

> Delete a PromptModel row from the database by its primary keys: \['id'].

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts/{id}":{"delete":{"tags":["Prompts"],"summary":"Delete","description":"Delete a PromptModel row from the database by its primary keys: ['id'].","operationId":"endpoint_prompts__id__delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Update

> Update an existing PromptModel row in the database by its primary keys: \['id'].

```json
{"openapi":"3.1.0","info":{"title":"GDP Labs General AI Starter","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":["read:all"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"read:all":"Read Permissions"},"tokenUrl":"token"}}}},"schemas":{"CreatePrompt":{"properties":{"codename":{"type":"string","title":"Codename"},"title":{"type":"string","title":"Title"},"value":{"type":"string","title":"Value"},"variables":{"type":"string","title":"Variables"}},"type":"object","required":["codename","title","value","variables"],"title":"CreatePrompt","description":"Create Prompt model."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/prompts/{id}":{"patch":{"tags":["Prompts"],"summary":"Update","description":"Update an existing PromptModel row in the database by its primary keys: ['id'].","operationId":"endpoint_prompts__id__patch","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePrompt"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```
