First, perform OCR on each document page to convert it into text. Then, use OpenAI embeddings API to generate an embedding for this text. Then, query this embedding in a ChromaDB database against the embeddings of pages you already classified. The query's result gives the most related page to the one being queried and is then classified with the same type.