mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-01 19:12:42 +00:00
langchain[patch]: update removal target for LLMChain (#23373)
to 1.0 Also improve replacement example in docstring.
This commit is contained in:
@@ -38,7 +38,7 @@ from langchain.chains.base import Chain
|
|||||||
@deprecated(
|
@deprecated(
|
||||||
since="0.1.17",
|
since="0.1.17",
|
||||||
alternative="RunnableSequence, e.g., `prompt | llm`",
|
alternative="RunnableSequence, e.g., `prompt | llm`",
|
||||||
removal="0.3.0",
|
removal="1.0",
|
||||||
)
|
)
|
||||||
class LLMChain(Chain):
|
class LLMChain(Chain):
|
||||||
"""Chain to run queries against LLMs.
|
"""Chain to run queries against LLMs.
|
||||||
@@ -48,6 +48,7 @@ class LLMChain(Chain):
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
from langchain_core.output_parsers import StrOutputParser
|
||||||
from langchain_core.prompts import PromptTemplate
|
from langchain_core.prompts import PromptTemplate
|
||||||
from langchain_openai import OpenAI
|
from langchain_openai import OpenAI
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ class LLMChain(Chain):
|
|||||||
input_variables=["adjective"], template=prompt_template
|
input_variables=["adjective"], template=prompt_template
|
||||||
)
|
)
|
||||||
llm = OpenAI()
|
llm = OpenAI()
|
||||||
chain = prompt | llm
|
chain = prompt | llm | StrOutputParser()
|
||||||
|
|
||||||
chain.invoke("your adjective here")
|
chain.invoke("your adjective here")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user