View Source LangChain.Chains.TextToTitleChain (LangChain v0.3.0-rc.0)
A convenience chain for turning a user's prompt text into a summarized title for the anticipated conversation.
Summary
Functions
Runs the TextToTitleChain and evaluates the result to return the final answer.
If it was unable to generate a title, the fallback_title
is returned.
Start a new LLMChain configuration.
Start a new TextToTitleChain and return it or raise an error if invalid.
Run a simple LLMChain to summarize the user's prompt into a title for the conversation. Uses the provided model. Recommend faster, simpler LLMs without streaming.
Types
Functions
Runs the TextToTitleChain and evaluates the result to return the final answer.
If it was unable to generate a title, the fallback_title
is returned.
@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Start a new LLMChain configuration.
{:ok, chain} = LLMChain.new(%{
llm: %ChatOpenAI{model: "gpt-3.5-turbo", stream: false},
input_text: "Let's create a marketing blog post about our new product 'Fuzzy Furries'"
})
Start a new TextToTitleChain and return it or raise an error if invalid.
chain = TextToTitleChain.new!(%{
llm: %ChatOpenAI{model: "gpt-3.5-turbo", stream: false},
input_text: "Let's create a marketing blog post about our new product 'Fuzzy Furries'"
})
Run a simple LLMChain to summarize the user's prompt into a title for the conversation. Uses the provided model. Recommend faster, simpler LLMs without streaming.
If it fails to summarize to a title, it returns the default text.
new_title = TextToTitleChain.new!(%{
llm: %ChatOpenAI{model: "gpt-3.5-turbo", stream: false},
input_text: "Let's create a marketing blog post about our new product 'Fuzzy Furries'"
})
|> TextToTitleChain.run()