from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate
prompt1 = ChatPromptTemplate.from_template("what is the city {person} is from?") prompt2 = ChatPromptTemplate.from_template( "what country is the city {city} in? respond in {language}" )
from langchain_core.runnables import RunnablePassthrough
prompt1 = ChatPromptTemplate.from_template( "generate a {attribute} color. Return the name of the color and nothing else:" ) prompt2 = ChatPromptTemplate.from_template( "what is a fruit of color: {color}. Return the name of the fruit and nothing else:" ) prompt3 = ChatPromptTemplate.from_template( "what is a country with a flag that has the color: {color}. Return the name of the country and nothing else:" ) prompt4 = ChatPromptTemplate.from_template( "What is the color of {fruit} and the flag of {country}?" )
AIMessage(content=“The color of a peach can vary depending on its ripeness. Generally, a ripe peach is characterized
by a warm, yellow-orange hue with some variations of red or pink shades on its skin. These colors give the fruit an
appealing and vibrant appearance.\n\nThe flag of Georgia, referring to the U.S. state and not to the country located
at
the intersection of Europe and Asia, consists of three equal horizontal bands. The colors of the bands are as follows:
\n\n1. Top band: Dark red - this represents the courage and determination of the people of Georgia.\n2. Middle band:
White - this symbolizes the mountain peaks and the virtue of purity in the state.\n3. Bottom band: Sky blue - this
signifies the Georgia state’s hospitality and staying power.\n\nIn summary, the color of a ripe peach typically
consists
of yellow-orange, red, or pink shades, while the flag of Georgia, the U.S. state, comprises dark red, white, and sky
blue bands.”, response_metadata={‘token_usage’: {‘completion_tokens’: 198, ‘prompt_tokens’: 15, ‘total_tokens’:
213}, ’
model_name’: ‘moonshot-v1-8k’, ‘system_fingerprint’: None, ‘finish_reason’: ‘stop’, ‘logprobs’: None})