Me i will send you a big requirements doc. you shall proceed to send me a file tree. I will, ask you for a few files at a time. You shall give me the code step by step. deal?
ChatGPT Understood, you want to send a requirements document and want a file tree in response. Will provide code files step-by-step upon request. Deal accepted. Note: I can't literally send files, but I can provide text-based representations of what the code files should contain.
we are using fastapi.
- This gateway api is the main point of contact for the interfaces
- It has the following main components;
- a basic server
- an endpoint to receive a request to create a memeRequest.
- a util folder that incl:
- a service file called ai_service that handles tasks executed by AI’s
- initializes an openAI gpt3 model.
- includes a function called call(string, maxTokens=1000), temperature set to 0.5
- includes a function called generateCaptions(memeRequest, template) uses a template string stored under prompt_templates/get_captions.txt
- calls client.call(templated prompt).
- splits it into ‘template.line’ lines
- a file that handles common s3 functions like initializing connections, getting stuff, putting stuff
- a service file called ai_service that handles tasks executed by AI’s
- a logic module that includes:
- memeService
- this will contact an external memeClient
- a function getMatchingMemeTemplates(memeReq, n=6) that takes in a MemeRequest and returns a list of n Templates
- for each template, asyncly calls generateMeme(memeReq, template_i)
- a function called generateMeme(memeReq, template)
- template DataType includes a property called ‘Description’.
- calls the ai_service.generateCaptions(memeRequest, template)
- calls the memeClient.generateMeme(templateId, captions)
- using storageModule, stores the meme (in s3) as follows
- {memeRequest.companyName}/{template_id}_{uuid}
- memeService
- a storage module that includes:
- a file with all the models
- the data type MemeRequest is:
- companyName: string
- productDescription: string
- the data type Template is:
- lines: number
- description: str
- id: str
- the data type MemeRequest is:
- a file with all the functions to store/ retrieve the models ChatGPT Based on your FastAPI project requirements, here is a proposed file tree: bash
- a file with all the models
├── main.py # Entry point
├── services
│ └── gateway
│ ├── server.py # Basic server setup
│ ├── endpoint.py # API endpoints
│ └── util
│ ├── ai_service.py # AI-related tasks
│ └── s3_common.py # S3 utilities
│ ├── logic
│ └── meme_service.py # Meme logic
│ └── storage
│ ├── models.py # Data models
│ └── storage_functions.py # Functions to interact with storage
└── prompt_templates
└── get_captions.txt # Template string for caption generationmain.py: FastAPI app initialization, imports modules, and routes.
services/gateway/server.py: Basic FastAPI server setup with initial routes and middleware.
services/gateway/endpoint.py: Endpoint to handle meme requests.
services/gateway/util/ai_service.py: Initialization of OpenAI GPT-3, call() and generateCaptions() functions.
services/gateway/util/s3_common.py: S3-related utility functions like initializing connections, get, and put operations.
services/gateway/logic/meme_service.py: Includes getMatchingMemeTemplates() and generateMeme() functions.
services/gateway/storage/models.py: Defines MemeRequest and Template data types.
services/gateway/storage/storage_functions.py: Functions for storing and retrieving models.
prompt_templates/get_captions.txt: Template string for AI caption generation.
Let me know which files you would like to explore first.