mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
a29cd89923
### Description Implements synthetic data generation with the fields and preferences given by the user. Adds showcase notebook. Corresponding prompt was proposed for langchain-hub. ### Example ``` output = chain({"fields": {"colors": ["blue", "yellow"]}, "preferences": {"style": "Make it in a style of a weather forecast."}}) print(output) # {'fields': {'colors': ['blue', 'yellow']}, 'preferences': {'style': 'Make it in a style of a weather forecast.'}, 'text': "Good morning! Today's weather forecast brings a beautiful combination of colors to the sky, with hues of blue and yellow gently blending together like a mesmerizing painting."} ``` ### Twitter handle @deepsense_ai @matt_wosinski --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
16 lines
459 B
Python
16 lines
459 B
Python
from langchain.prompts.prompt import PromptTemplate
|
|
|
|
sentence_template = """Given the following fields, create a sentence about them.
|
|
Make the sentence detailed and interesting. Use every given field.
|
|
If any additional preferences are given, use them during sentence construction as well.
|
|
Fields:
|
|
{fields}
|
|
Preferences:
|
|
{preferences}
|
|
Sentence:
|
|
"""
|
|
|
|
SENTENCE_PROMPT = PromptTemplate(
|
|
template=sentence_template, input_variables=["fields", "preferences"]
|
|
)
|