File size: 769 Bytes
83a18c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from langchain_core.prompts import ChatPromptTemplate
from src.config.llm import llm_2_0 as llm

prompt = ChatPromptTemplate(
    [
        {
            "role": "system",
            "content": """You are expert in invoice extraction.
You are a teacher of {domain}.
You are given an image in a lesson about {topic}.
Explain and answer the user question.

User question: {question}


""",
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "data:image/jpeg;base64,{base64_image}",
                        "detail": "auto",
                    },
                },
            ],
        },
    ]
)

chain = prompt | llm