From c48be985a0c3fcb1d857fdf23d3110977889144b Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 08:01:00 +0000 Subject: [PATCH 1/6] fixed test --- redbox-core/redbox/models/chain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redbox-core/redbox/models/chain.py b/redbox-core/redbox/models/chain.py index 38da6e9d1..6768e0219 100644 --- a/redbox-core/redbox/models/chain.py +++ b/redbox-core/redbox/models/chain.py @@ -15,7 +15,7 @@ from langchain_core.documents import Document from langchain_core.messages import ToolCall from langgraph.managed.is_last_step import RemainingStepsManager -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, Extra from redbox.models import prompts @@ -383,7 +383,7 @@ def merge_redbox_state_updates(current: RedboxState, update: RedboxState) -> Red return merged_state -class GeneratedMetadata(BaseModel): +class GeneratedMetadata(BaseModel, extra=Extra.allow): """Document Metadata generated by ther LLM""" name: str | None = Field(description="document name", default=None) From 78316fce6e2a4cad60fc0668eb35af38aa33deb2 Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 08:03:24 +0000 Subject: [PATCH 2/6] fixed test --- redbox-core/redbox/loader/loaders.py | 1 + redbox-core/redbox/models/chain.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/redbox-core/redbox/loader/loaders.py b/redbox-core/redbox/loader/loaders.py index abe07ed31..3d0eba6d3 100644 --- a/redbox-core/redbox/loader/loaders.py +++ b/redbox-core/redbox/loader/loaders.py @@ -8,6 +8,7 @@ import requests import tiktoken from langchain_core.documents import Document +from langchain_core.output_parsers import JsonOutputParser from redbox.chains.components import get_chat_llm diff --git a/redbox-core/redbox/models/chain.py b/redbox-core/redbox/models/chain.py index 6768e0219..38da6e9d1 100644 --- a/redbox-core/redbox/models/chain.py +++ b/redbox-core/redbox/models/chain.py @@ -15,7 +15,7 @@ from langchain_core.documents import Document from langchain_core.messages import ToolCall from langgraph.managed.is_last_step import RemainingStepsManager -from pydantic import BaseModel, Field, Extra +from pydantic import BaseModel, Field from redbox.models import prompts @@ -383,7 +383,7 @@ def merge_redbox_state_updates(current: RedboxState, update: RedboxState) -> Red return merged_state -class GeneratedMetadata(BaseModel, extra=Extra.allow): +class GeneratedMetadata(BaseModel): """Document Metadata generated by ther LLM""" name: str | None = Field(description="document name", default=None) From 3607062172250befeb11f785e9bbeeb659317acf Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 13:15:57 +0000 Subject: [PATCH 3/6] removed max_length --- redbox-core/redbox/models/chain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redbox-core/redbox/models/chain.py b/redbox-core/redbox/models/chain.py index 38da6e9d1..23da941f8 100644 --- a/redbox-core/redbox/models/chain.py +++ b/redbox-core/redbox/models/chain.py @@ -384,8 +384,8 @@ def merge_redbox_state_updates(current: RedboxState, update: RedboxState) -> Red class GeneratedMetadata(BaseModel): - """Document Metadata generated by ther LLM""" + """Document Metadata generated by the LLM""" name: str | None = Field(description="document name", default=None) - description: str | None = Field(description="document description", max_length=100, default=None) - keywords: list[str] = Field(description="document keywords", max_length=5, default_factory=list) + description: str | None = Field(description="document description", default=None) + keywords: list[str] = Field(description="document keywords", default_factory=list) From 9c920b4298fcb38fc25be4dd6e9b5adfdb403edc Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 13:17:35 +0000 Subject: [PATCH 4/6] removed max_length --- redbox-core/redbox/models/chain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redbox-core/redbox/models/chain.py b/redbox-core/redbox/models/chain.py index 23da941f8..b67c84b7e 100644 --- a/redbox-core/redbox/models/chain.py +++ b/redbox-core/redbox/models/chain.py @@ -388,4 +388,4 @@ class GeneratedMetadata(BaseModel): name: str | None = Field(description="document name", default=None) description: str | None = Field(description="document description", default=None) - keywords: list[str] = Field(description="document keywords", default_factory=list) + keywords: list[str] = Field(description="document keywords", max_length=5, default_factory=list) From 4259e16cb5ef871c0b3595934537c687bcfc9484 Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 13:23:42 +0000 Subject: [PATCH 5/6] formatting --- redbox-core/redbox/loader/loaders.py | 1 - 1 file changed, 1 deletion(-) diff --git a/redbox-core/redbox/loader/loaders.py b/redbox-core/redbox/loader/loaders.py index 3d0eba6d3..abe07ed31 100644 --- a/redbox-core/redbox/loader/loaders.py +++ b/redbox-core/redbox/loader/loaders.py @@ -8,7 +8,6 @@ import requests import tiktoken from langchain_core.documents import Document -from langchain_core.output_parsers import JsonOutputParser from redbox.chains.components import get_chat_llm From 8d154e0b3874871c79fec134d4396dafb1085fa3 Mon Sep 17 00:00:00 2001 From: gecBurton Date: Thu, 31 Oct 2024 13:41:08 +0000 Subject: [PATCH 6/6] losened UploadedFileMetadata reqs --- redbox-core/redbox/models/file.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redbox-core/redbox/models/file.py b/redbox-core/redbox/models/file.py index 14ed2f7f6..8aecfb359 100644 --- a/redbox-core/redbox/models/file.py +++ b/redbox-core/redbox/models/file.py @@ -42,7 +42,7 @@ class UploadedFileMetadata(ChunkMetadata): """ page_number: int | None = None - name: str - description: str - keywords: list[str] + name: str | None = None + description: str | None = None + keywords: list[str] | None = None creator_type: ChunkCreatorType = ChunkCreatorType.user_uploaded_document