From cfef15e19fd61b74f54cd0302f7200ca98ddff36 Mon Sep 17 00:00:00 2001 From: inahjeon Date: Wed, 8 Jan 2025 20:57:51 +0900 Subject: [PATCH 1/2] update model name and remove deprecated upstage layout analysis model --- cookbook/README.md | 2 +- ...> rag_upstage_document_parse_groundedness_check.ipynb} | 8 ++++---- libs/community/langchain_community/chat_models/solar.py | 2 +- libs/community/langchain_community/embeddings/solar.py | 2 +- libs/community/langchain_community/llms/solar.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename cookbook/{rag_upstage_layout_analysis_groundedness_check.ipynb => rag_upstage_document_parse_groundedness_check.ipynb} (89%) diff --git a/cookbook/README.md b/cookbook/README.md index cfb9ea8e73473..2b90e07c7919a 100644 --- a/cookbook/README.md +++ b/cookbook/README.md @@ -50,7 +50,7 @@ Notebook | Description [press_releases.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/press_releases.ipynb) | Retrieve and query company press release data powered by [Kay.ai](https://kay.ai). [program_aided_language_model.i...](https://github.com/langchain-ai/langchain/tree/master/cookbook/program_aided_language_model.ipynb) | Implement program-aided language models as described in the provided research paper. [qa_citations.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/qa_citations.ipynb) | Different ways to get a model to cite its sources. -[rag_upstage_layout_analysis_groundedness_check.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/rag_upstage_layout_analysis_groundedness_check.ipynb) | End-to-end RAG example using Upstage Layout Analysis and Groundedness Check. +[rag_upstage_document_parse_groundedness_check.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/rag_upstage_document_parse_groundedness_check.ipynb) | End-to-end RAG example using Upstage Document Parse and Groundedness Check. [retrieval_in_sql.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/retrieval_in_sql.ipynb) | Perform retrieval-augmented-generation (rag) on a PostgreSQL database using pgvector. [sales_agent_with_context.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/sales_agent_with_context.ipynb) | Implement a context-aware ai sales agent, salesgpt, that can have natural sales conversations, interact with other systems, and use a product knowledge base to discuss a company's offerings. [self_query_hotel_search.ipynb](https://github.com/langchain-ai/langchain/tree/master/cookbook/self_query_hotel_search.ipynb) | Build a hotel room search feature with self-querying retrieval, using a specific hotel recommendation dataset. diff --git a/cookbook/rag_upstage_layout_analysis_groundedness_check.ipynb b/cookbook/rag_upstage_document_parse_groundedness_check.ipynb similarity index 89% rename from cookbook/rag_upstage_layout_analysis_groundedness_check.ipynb rename to cookbook/rag_upstage_document_parse_groundedness_check.ipynb index fafb1dfbbad0c..83b46d167911a 100644 --- a/cookbook/rag_upstage_layout_analysis_groundedness_check.ipynb +++ b/cookbook/rag_upstage_document_parse_groundedness_check.ipynb @@ -4,8 +4,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# RAG using Upstage Layout Analysis and Groundedness Check\n", - "This example illustrates RAG using [Upstage](https://python.langchain.com/docs/integrations/providers/upstage/) Layout Analysis and Groundedness Check." + "# RAG using Upstage Document Parse and Groundedness Check\n", + "This example illustrates RAG using [Upstage](https://python.langchain.com/docs/integrations/providers/upstage/) Document Parse and Groundedness Check." ] }, { @@ -25,14 +25,14 @@ " ChatUpstage,\n", " UpstageEmbeddings,\n", " UpstageGroundednessCheck,\n", - " UpstageLayoutAnalysisLoader,\n", + " UpstageDocumentParseLoader,\n", ")\n", "\n", "model = ChatUpstage()\n", "\n", "files = [\"/PATH/TO/YOUR/FILE.pdf\", \"/PATH/TO/YOUR/FILE2.pdf\"]\n", "\n", - "loader = UpstageLayoutAnalysisLoader(file_path=files, split=\"element\")\n", + "loader = UpstageDocumentParseLoader(file_path=files, split=\"element\")\n", "\n", "docs = loader.load()\n", "\n", diff --git a/libs/community/langchain_community/chat_models/solar.py b/libs/community/langchain_community/chat_models/solar.py index 1f2da3244c8c1..4bcdc0952aa82 100644 --- a/libs/community/langchain_community/chat_models/solar.py +++ b/libs/community/langchain_community/chat_models/solar.py @@ -24,7 +24,7 @@ class SolarChat(SolarCommon, ChatOpenAI): # type: ignore[override, override] from langchain_community.chat_models.solar import SolarChat - solar = SolarChat(model="solar-1-mini-chat") + solar = SolarChat(model="solar-mini") """ max_tokens: int = Field(default=1024) diff --git a/libs/community/langchain_community/embeddings/solar.py b/libs/community/langchain_community/embeddings/solar.py index e730d7e6e9625..13d0c02648925 100644 --- a/libs/community/langchain_community/embeddings/solar.py +++ b/libs/community/langchain_community/embeddings/solar.py @@ -70,7 +70,7 @@ class SolarEmbeddings(BaseModel, Embeddings): endpoint_url: str = "https://api.upstage.ai/v1/solar/embeddings" """Endpoint URL to use.""" - model: str = "solar-1-mini-embedding-query" + model: str = "embedding-query" """Embeddings model name to use.""" solar_api_key: Optional[SecretStr] = None """API Key for Solar API.""" diff --git a/libs/community/langchain_community/llms/solar.py b/libs/community/langchain_community/llms/solar.py index b5ea74bd6323b..8bfaecd50350f 100644 --- a/libs/community/langchain_community/llms/solar.py +++ b/libs/community/langchain_community/llms/solar.py @@ -44,7 +44,7 @@ class SolarCommon(BaseModel): base_url: str = SOLAR_SERVICE_URL_BASE solar_api_key: Optional[SecretStr] = Field(default=None, alias="api_key") """Solar API key. Get it here: https://console.upstage.ai/services/solar""" - model_name: str = Field(default="solar-1-mini-chat", alias="model") + model_name: str = Field(default="solar-mini", alias="model") """Model name. Available models listed here: https://console.upstage.ai/services/solar""" max_tokens: int = Field(default=1024) temperature: float = 0.3 From bf9a049f2451c57e0ced1c67450ccb0dac91c909 Mon Sep 17 00:00:00 2001 From: inahjeon Date: Wed, 8 Jan 2025 21:13:59 +0900 Subject: [PATCH 2/2] fix lint --- cookbook/rag_upstage_document_parse_groundedness_check.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/rag_upstage_document_parse_groundedness_check.ipynb b/cookbook/rag_upstage_document_parse_groundedness_check.ipynb index 83b46d167911a..6fba9623ca3b4 100644 --- a/cookbook/rag_upstage_document_parse_groundedness_check.ipynb +++ b/cookbook/rag_upstage_document_parse_groundedness_check.ipynb @@ -23,9 +23,9 @@ "from langchain_core.runnables.base import RunnableSerializable\n", "from langchain_upstage import (\n", " ChatUpstage,\n", + " UpstageDocumentParseLoader,\n", " UpstageEmbeddings,\n", " UpstageGroundednessCheck,\n", - " UpstageDocumentParseLoader,\n", ")\n", "\n", "model = ChatUpstage()\n",