mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-18 09:01:03 +00:00
experimental[patch], docs: refine notebook for MyScale SelfQueryRetriever
(#22016)
- **Description:** upgrade model to `gpt-4o`
This commit is contained in:
parent
d948783a4c
commit
63284ffebf
@ -162,12 +162,14 @@
|
||||
"source": [
|
||||
"from langchain.chains.query_constructor.base import AttributeInfo\n",
|
||||
"from langchain.retrievers.self_query.base import SelfQueryRetriever\n",
|
||||
"from langchain_openai import OpenAI\n",
|
||||
"from langchain_openai import ChatOpenAI\n",
|
||||
"\n",
|
||||
"metadata_field_info = [\n",
|
||||
" AttributeInfo(\n",
|
||||
" name=\"genre\",\n",
|
||||
" description=\"The genres of the movie\",\n",
|
||||
" description=\"The genres of the movie. \"\n",
|
||||
" \"It only supports equal and contain comparisons. \"\n",
|
||||
" \"Here are some examples: genre = [' A '], genre = [' A ', 'B'], contain (genre, 'A')\",\n",
|
||||
" type=\"list[string]\",\n",
|
||||
" ),\n",
|
||||
" # If you want to include length of a list, just define it as a new column\n",
|
||||
@ -193,7 +195,7 @@
|
||||
" ),\n",
|
||||
"]\n",
|
||||
"document_content_description = \"Brief summary of a movie\"\n",
|
||||
"llm = OpenAI(temperature=0)\n",
|
||||
"llm = ChatOpenAI(temperature=0, model_name=\"gpt-4o\")\n",
|
||||
"retriever = SelfQueryRetriever.from_llm(\n",
|
||||
" llm, vectorstore, document_content_description, metadata_field_info, verbose=True\n",
|
||||
")"
|
||||
|
@ -40,7 +40,7 @@ class VectorSQLOutputParser(BaseOutputParser[str]):
|
||||
@classmethod
|
||||
def from_embeddings(
|
||||
cls, model: Embeddings, distance_func_name: str = "distance", **kwargs: Any
|
||||
) -> BaseOutputParser:
|
||||
) -> VectorSQLOutputParser:
|
||||
return cls(model=model, distance_func_name=distance_func_name, **kwargs)
|
||||
|
||||
def parse(self, text: str) -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user