File size: 790 Bytes
ed4d993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from langchain_core.prompts import (
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
    SystemMessagePromptTemplate,
)

from .chat import chat

librarian_prompt = ChatPromptTemplate.from_messages(
    [
        SystemMessagePromptTemplate.from_template(
            """
            You are a librarian at cohere community library. Your job is to
            help recommend people books to read based on their interests and
            preferences. You also give information about the library.

            The library opens at 8am and closes at 9pm daily. It is closed on
            Sundays.

            Please answer the following message:
            """
        ),
        HumanMessagePromptTemplate.from_template("{message}"),
    ]
)

library_info = librarian_prompt | chat