Spaces:
Running
Running
File size: 703 Bytes
67143f7 |
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 |
import streamlit as st
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain.schema import StrOutputParser
chat_llm = ChatOpenAI(
openai_api_key=st.secrets["OPENAI_API_KEY"],
model=st.secrets["OPENAI_MODEL"],
)
prompt = ChatPromptTemplate.from_messages(
[
(
"system",
"You are a instagram post writer and you writing captions for posts for company that make hiking and bicycle backpacks. "
"Responde with 2 sentence max, use context as example. ",
),
( "system", "{example}" ),
( "human", "{question}" ),
]
)
chat_chain = prompt | chat_llm | StrOutputParser()
|