langchain[small]: Change type to BasePromptTemplate (#23083)

```python
Change from_llm(
 prompt: PromptTemplate 
 ...
 )
```
 to
```python
Change from_llm(
 prompt: BasePromptTemplate 
 ...
 )
```
This commit is contained in:
Philippe PRADOS 2024-06-19 19:19:36 +02:00 committed by GitHub
parent 94452a94b1
commit db6f46c1a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ from langchain_core.callbacks import (
from langchain_core.documents import Document from langchain_core.documents import Document
from langchain_core.language_models import BaseLanguageModel from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers import BaseOutputParser from langchain_core.output_parsers import BaseOutputParser
from langchain_core.prompts import BasePromptTemplate
from langchain_core.prompts.prompt import PromptTemplate from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.retrievers import BaseRetriever from langchain_core.retrievers import BaseRetriever
from langchain_core.runnables import Runnable from langchain_core.runnables import Runnable
@ -62,7 +63,7 @@ class MultiQueryRetriever(BaseRetriever):
cls, cls,
retriever: BaseRetriever, retriever: BaseRetriever,
llm: BaseLanguageModel, llm: BaseLanguageModel,
prompt: PromptTemplate = DEFAULT_QUERY_PROMPT, prompt: BasePromptTemplate = DEFAULT_QUERY_PROMPT,
parser_key: Optional[str] = None, parser_key: Optional[str] = None,
include_original: bool = False, include_original: bool = False,
) -> "MultiQueryRetriever": ) -> "MultiQueryRetriever":

View File

@ -7,6 +7,7 @@ from langchain_core.callbacks import (
) )
from langchain_core.documents import Document from langchain_core.documents import Document
from langchain_core.language_models import BaseLLM from langchain_core.language_models import BaseLLM
from langchain_core.prompts import BasePromptTemplate
from langchain_core.prompts.prompt import PromptTemplate from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.retrievers import BaseRetriever from langchain_core.retrievers import BaseRetriever
@ -36,7 +37,7 @@ class RePhraseQueryRetriever(BaseRetriever):
cls, cls,
retriever: BaseRetriever, retriever: BaseRetriever,
llm: BaseLLM, llm: BaseLLM,
prompt: PromptTemplate = DEFAULT_QUERY_PROMPT, prompt: BasePromptTemplate = DEFAULT_QUERY_PROMPT,
) -> "RePhraseQueryRetriever": ) -> "RePhraseQueryRetriever":
"""Initialize from llm using default template. """Initialize from llm using default template.