From 5101720c25c0efa8737c98a0fa2ae9f8316967ee Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:15:14 -0400 Subject: [PATCH 1/9] x --- docs/source/schema_serialization.ipynb | 144 +++++++++++++------------ kor/nodes.py | 62 ++--------- kor/serializer.py | 26 +++++ tests/test_serialization.py | 115 ++++++-------------- 4 files changed, 144 insertions(+), 203 deletions(-) create mode 100644 kor/serializer.py diff --git a/docs/source/schema_serialization.ipynb b/docs/source/schema_serialization.ipynb index 0ac6e44..5019701 100644 --- a/docs/source/schema_serialization.ipynb +++ b/docs/source/schema_serialization.ipynb @@ -7,9 +7,7 @@ "source": [ "# Schema serialization\n", "\n", - "A Kor schema can be serialized and deserialzed to JSON. This lets you store the schema outside of the code.\n", - "\n", - "**ATTENTION** This only works with pydantic v1 at the moment." + "A Kor schema can be serialized and deserialzed to JSON. This lets you store the schema outside of the code." ] }, { @@ -41,7 +39,8 @@ }, "outputs": [], "source": [ - "from kor.nodes import Object, Text, Number" + "from kor.nodes import Object, Text, Number\n", + "from kor.serializer import loads, dumps" ] }, { @@ -66,7 +65,71 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\"id\": \"personal_info\", \"description\": \"Personal information about a given person.\", \"many\": true, \"attributes\": [{\"id\": \"first_name\", \"description\": \"The first name of the person\", \"many\": false, \"examples\": [[\"John Smith went to the store\", \"John\"]], \"$type\": \"Text\"}, {\"id\": \"last_name\", \"description\": \"The last name of the person\", \"many\": false, \"examples\": [[\"John Smith went to the store\", \"Smith\"]], \"$type\": \"Text\"}, {\"id\": \"age\", \"description\": \"The age of the person in years.\", \"many\": false, \"examples\": [[\"23 years old\", \"23\"], [\"I turned three on sunday\", \"3\"]], \"$type\": \"Number\"}], \"examples\": [[\"John Smith was 23 years old. He was very tall. He knew Jane Doe. She was 5 years old.\", [{\"first_name\": \"John\", \"last_name\": \"Smith\", \"age\": 23}, {\"first_name\": \"Jane\", \"last_name\": \"Doe\", \"age\": 5}]]]}\n" + "{\n", + " \"attributes\": [\n", + " {\n", + " \"description\": \"The first name of the person\",\n", + " \"examples\": [\n", + " [\n", + " \"John Smith went to the store\",\n", + " \"John\"\n", + " ]\n", + " ],\n", + " \"id\": \"first_name\",\n", + " \"many\": false,\n", + " \"type\": \"text\"\n", + " },\n", + " {\n", + " \"description\": \"The last name of the person\",\n", + " \"examples\": [\n", + " [\n", + " \"John Smith went to the store\",\n", + " \"Smith\"\n", + " ]\n", + " ],\n", + " \"id\": \"last_name\",\n", + " \"many\": false,\n", + " \"type\": \"text\"\n", + " },\n", + " {\n", + " \"description\": \"The age of the person in years.\",\n", + " \"examples\": [\n", + " [\n", + " \"23 years old\",\n", + " 23\n", + " ],\n", + " [\n", + " \"I turned three on sunday\",\n", + " 3\n", + " ]\n", + " ],\n", + " \"id\": \"age\",\n", + " \"many\": false,\n", + " \"type\": \"number\"\n", + " }\n", + " ],\n", + " \"description\": \"Personal information about a given person.\",\n", + " \"examples\": [\n", + " [\n", + " \"John Smith was 23 years old. He was very tall. He knew Jane Doe. She was 5 years old.\",\n", + " [\n", + " {\n", + " \"age\": 23,\n", + " \"first_name\": \"John\",\n", + " \"last_name\": \"Smith\"\n", + " },\n", + " {\n", + " \"age\": 5,\n", + " \"first_name\": \"Jane\",\n", + " \"last_name\": \"Doe\"\n", + " }\n", + " ]\n", + " ]\n", + " ],\n", + " \"id\": \"personal_info\",\n", + " \"many\": true,\n", + " \"type\": \"object\"\n", + "}\n" ] } ], @@ -103,7 +166,7 @@ " many=True,\n", ")\n", "\n", - "print(schema.json())" + "print(dumps(schema, sort_keys=True, indent=2))" ] }, { @@ -113,81 +176,31 @@ "source": [ "## Deserialization\n", "\n", - "Kor lets you define the schema in JSON. The structure of the JSON matches the struture of the `Object` type.\n", - "\n", - "The following attribute types must be annotated with a type descrimintator (`$type`):\n", - "\n", - "- Number\n", - "- Text\n", - "- Bool\n", - "- Selection" + "Kor lets you define the schema in JSON. The structure of the JSON matches the struture of the `Object` type." ] }, { "cell_type": "code", "execution_count": 4, - "id": "3bd33817", + "id": "6346cef2-f73d-47f8-b171-a3b960af6ca4", "metadata": { "tags": [] }, "outputs": [], "source": [ - "json = \"\"\"\n", - "{\n", - " \"id\": \"personal_info\",\n", - " \"description\": \"Personal information about a given person.\",\n", - " \"attributes\": [\n", - " {\n", - " \"$type\": \"Text\",\n", - " \"id\": \"first_name\",\n", - " \"description\": \"The first name of the person\",\n", - " \"examples\": [[\"John Smith went to the store\", \"John\"]]\n", - " },\n", - " {\n", - " \"$type\": \"Text\",\n", - " \"id\": \"last_name\",\n", - " \"description\": \"The last name of the person\",\n", - " \"examples\": [[\"John Smith went to the store\", \"Smith\"]]\n", - " },\n", - " {\n", - " \"$type\": \"Number\",\n", - " \"id\": \"age\",\n", - " \"description\": \"The age of the person in years.\",\n", - " \"examples\": [[\"23 years old\", \"23\"], [\"I turned three on sunday\", \"3\"]]\n", - " }\n", - " ],\n", - " \"examples\": [\n", - " [\n", - " \"John Smith was 23 years old. He was very tall. He knew Jane Doe. She was 5 years old.\",\n", - " [\n", - " {\"first_name\": \"John\", \"last_name\": \"Smith\", \"age\": 23},\n", - " {\"first_name\": \"Jane\", \"last_name\": \"Doe\", \"age\": 5}\n", - " ]\n", - " ]\n", - " ],\n", - " \"many\": true\n", - "}\n", - "\"\"\"" - ] - }, - { - "cell_type": "markdown", - "id": "3581b713", - "metadata": {}, - "source": [ - "To deserialize a schema from JSON simply call the `parse_raw()` method." + "json = dumps(schema)" ] }, { "cell_type": "code", "execution_count": 5, - "id": "6088c98a", + "id": "f125f314-a9ee-4865-b573-a2b22570e80a", "metadata": { "tags": [] }, "outputs": [], "source": [ - "schema = Object.parse_raw(json)" + "deserialized_object = loads(json)" ] }, { @@ -216,7 +229,6 @@ " model_name=\"gpt-3.5-turbo\",\n", " temperature=0,\n", " max_tokens=2000,\n", - " model_kwargs={\"frequency_penalty\": 0, \"presence_penalty\": 0, \"top_p\": 1.0},\n", ")" ] }, @@ -234,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "193e257b-df01-45ec-af77-076d2070533b", "metadata": { "tags": [] @@ -246,7 +258,7 @@ "{'personal_info': [{'first_name': 'Eugene', 'last_name': '', 'age': '18'}]}" ] }, - "execution_count": 9, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -257,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "id": "c8295f36-f986-4db2-97bc-ef2e6cdbcc87", "metadata": { "tags": [] @@ -298,7 +310,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.9.6" } }, "nbformat": 4, diff --git a/kor/nodes.py b/kor/nodes.py index 414cc10..fe9a567 100644 --- a/kor/nodes.py +++ b/kor/nodes.py @@ -6,22 +6,17 @@ from typing import ( Any, Generic, + Literal, Mapping, Optional, Sequence, Tuple, - Type, TypeVar, Union, ) from pydantic import BaseModel -from ._pydantic import PYDANTIC_MAJOR_VERSION - -# Name of field to store the type discriminator -TYPE_DISCRIMINATOR_FIELD = "$type" - T = TypeVar("T") @@ -117,34 +112,6 @@ class ExtractionSchemaNode(AbstractSchemaNode, abc.ABC): Tuple[str, Union[bool, int, float, str, Sequence[Union[str, int, float, bool]]]] ] = tuple() - def __init__(self, **kwargs: Any) -> None: - """Initialize.""" - super().__init__(**kwargs) - if PYDANTIC_MAJOR_VERSION == 1: - self.__dict__[TYPE_DISCRIMINATOR_FIELD] = type(self).__name__ - - @classmethod - def parse_obj(cls, data: dict) -> ExtractionSchemaNode: - """Parse an object.""" - if PYDANTIC_MAJOR_VERSION != 1: - raise NotImplementedError("Only supported for pydantic 1.x") - type_ = data.pop(TYPE_DISCRIMINATOR_FIELD, None) - if type_ is None: - raise ValueError(f"Need to specify type ({TYPE_DISCRIMINATOR_FIELD})") - for sub in cls.__subclasses__(): - if type_ == sub.__name__: - return sub(**data) - raise TypeError(f"Unknown sub-type: {type_}") - - @classmethod - def validate(cls: Type[ExtractionSchemaNode], v: Any) -> ExtractionSchemaNode: - if isinstance(v, dict): - return cls.parse_obj(v) - elif isinstance(v, cls): - return v - else: - raise TypeError(f"Unsupported type: {type(v)}") - class Number(ExtractionSchemaNode): """Built-in number input.""" @@ -153,6 +120,8 @@ class Number(ExtractionSchemaNode): Tuple[str, Union[int, float, Sequence[Union[float, int]]]] ] = tuple() + type: Literal["number"] = "number" + def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" return visitor.visit_number(self, **kwargs) @@ -162,6 +131,7 @@ class Text(ExtractionSchemaNode): """Built-in text input.""" examples: Sequence[Tuple[str, Union[Sequence[str], str]]] = tuple() + type: Literal["text"] = "text" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -172,6 +142,7 @@ class Bool(ExtractionSchemaNode): """Built-in bool input.""" examples: Sequence[Tuple[str, Union[Sequence[bool], bool]]] = tuple() + type: Literal["bool"] = "bool" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -182,6 +153,7 @@ class Option(AbstractSchemaNode): """Built-in option input must be part of a selection input.""" examples: Sequence[str] = tuple() + type: Literal["option"] = "option" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -224,6 +196,7 @@ class Selection(AbstractSchemaNode): options: Sequence[Option] examples: Sequence[Tuple[str, Union[str, Sequence[str]]]] = tuple() null_examples: Sequence[str] = tuple() + type: Literal["selection"] = "selection" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -257,7 +230,8 @@ class Object(AbstractSchemaNode): """ - attributes: Sequence[Union[ExtractionSchemaNode, Selection, Object]] + attributes: Sequence[Union[Selection, Object, Number, Text, Bool]] + type: Literal["object"] = "object" examples: Sequence[ Tuple[ @@ -272,21 +246,3 @@ class Object(AbstractSchemaNode): def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" return visitor.visit_object(self, **kwargs) - - @classmethod - def parse_raw(cls, *args: Any, **kwargs: Any) -> Object: - """Parse raw data.""" - if PYDANTIC_MAJOR_VERSION != 1: - raise NotImplementedError( - f"parse_raw is not supported for pydantic {PYDANTIC_MAJOR_VERSION}" - ) - return super().parse_raw(*args, **kwargs) - - @classmethod - def parse_obj(cls, *args: Any, **kwargs: Any) -> Object: - """Parse an object.""" - if PYDANTIC_MAJOR_VERSION != 1: - raise NotImplementedError( - f"parse_obj is not supported for pydantic {PYDANTIC_MAJOR_VERSION}" - ) - return super().parse_obj(*args, **kwargs) diff --git a/kor/serializer.py b/kor/serializer.py new file mode 100644 index 0000000..9558db9 --- /dev/null +++ b/kor/serializer.py @@ -0,0 +1,26 @@ +from typing import Optional + +from ._pydantic import PYDANTIC_MAJOR_VERSION +from .nodes import Object +import json + +# PUBLIC API + + +def loads(string: str) -> Object: + """Deserialize a string to a schema node.""" + if PYDANTIC_MAJOR_VERSION == 1: + return Object.parse_raw(string) + return Object.model_validate_json(string) + + +def dumps( + object: Object, *, indent: Optional[int] = None, sort_keys: bool = False +) -> str: + """Serialize a schema node to a string.""" + if PYDANTIC_MAJOR_VERSION == 1: + d = object.dict() + else: + d = object.model_dump() + + return json.dumps(d, indent=indent, sort_keys=sort_keys) diff --git a/tests/test_serialization.py b/tests/test_serialization.py index b09199c..6ded2a2 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -2,33 +2,15 @@ from typing import Any, Type import pytest +from pydantic import ValidationError from kor import Bool, Number, Object, Selection, Text -from kor._pydantic import PYDANTIC_MAJOR_VERSION from kor.nodes import ExtractionSchemaNode +from kor.serializer import dumps, loads -@pytest.fixture(params=ExtractionSchemaNode.__subclasses__()) -def extraction_subclass(request: Any) -> Any: - """Fixture to test all subclasses of ExtractionSchemaNode.""" - return request.param - - -@pytest.mark.skipif( - PYDANTIC_MAJOR_VERSION != 1, reason="Only implemented for pydantic 1" -) -def test_extraction_schema_node_has_type_discriminator( - extraction_subclass: Type[ExtractionSchemaNode], -) -> None: - """Test if all subclasses of ExtractionSchemaNode have a type discriminator.""" - node_type = extraction_subclass(id="test") - assert node_type.dict()["$type"] == extraction_subclass.__name__ - - -@pytest.mark.skipif( - PYDANTIC_MAJOR_VERSION != 1, reason="Only implemented for pydantic 1" -) def test_serialize_deserialize_equals() -> None: + """Test if serialization and deserialization are inverse operations.""" expected = Object( id="root", description="root-object", @@ -39,41 +21,11 @@ def test_serialize_deserialize_equals() -> None: ], examples=[], ) - - stringified = expected.json() - assert Object.parse_raw(stringified) == expected + stringified = dumps(expected) assert isinstance(stringified, str) - assert expected.dict() == { - "attributes": [ - { - "description": "Number description", - "examples": [], - "id": "number", - "many": False, - "$type": "Number", - }, - { - "description": "text description", - "examples": [], - "id": "text", - "many": False, - "$type": "Text", - }, - { - "description": "bool description", - "examples": [], - "id": "bool", - "many": False, - "$type": "Bool", - }, - ], - "description": "root-object", - "examples": [], - "id": "root", - "many": False, - } - - assert Object.parse_raw(stringified) == expected + loaded_obj = loads(stringified) + assert loaded_obj == expected + assert loaded_obj.schema() == expected.schema() def test_simple_deserialization() -> None: @@ -82,66 +34,65 @@ def test_simple_deserialization() -> None: "id": "sample_object", "description": "Deserialization Example", "many": true, + "type": "object", "attributes": [ { - "$type": "Number", "id": "number_attribute", "description": "Description for Number", "many": true, + "type": "number", "examples": [ ["Here is 1 number", 1], ["Here are 0 numbers", 0] ] }, { - "$type": "Text", "id": "text_attribute", "description": "Description for Text", "many": true, + "type": "text", "examples": [ ["Here is a text", "a text"], ["Here is no text", "no text"] ] }, { - "$type": "Bool", "id": "bool_attribute", "description": "Description for Bool", "many": true, + "type": "bool", "examples": [ ["This is soo true", true], ["This is wrong", false] ] }, { - "$type": "Selection", "id": "selection_attribute", "description": "Description for Selection", "many": true, + "type": "selection", "options": [ { "id": "option1", - "description": "description for option 1" + "description": "description for option 1", + "type": "option" }, { "id": "option2", - "description": "description for option 2" + "description": "description for option 2", + "type": "option" } ], "examples": [ - ["This is soo true", true], - ["This is wrong", false] + ["This is soo true", "true"], + ["This is wrong", "false"] ] } ] } """ - if PYDANTIC_MAJOR_VERSION == 2: - with pytest.raises(NotImplementedError): - scheme = Object.parse_raw(json) - return + scheme = loads(json) - scheme = Object.parse_raw(json) assert scheme.id == "sample_object" assert scheme.description == "Deserialization Example" assert scheme.many is True @@ -178,17 +129,19 @@ def test_nested_object_deserialization() -> None: "id": "root_object", "description": "Deserialization Example", "many": true, + "type": "object", "attributes": [ { "id": "nested_object", "description": "Description nested object", "many": true, + "type": "object", "attributes": [ { - "$type": "Number", "id": "number_attribute", "description": "Description for Number", "many": true, + "type": "number", "examples": [ ["Here is 1 number", 1], ["Here are 0 numbers", 0] @@ -199,11 +152,7 @@ def test_nested_object_deserialization() -> None: ] } """ - if PYDANTIC_MAJOR_VERSION == 2: - with pytest.raises(NotImplementedError): - scheme = Object.parse_raw(json) - return - scheme = Object.parse_raw(json) + scheme = loads(json) assert scheme.id == "root_object" assert scheme.description == "Deserialization Example" @@ -216,7 +165,10 @@ def test_nested_object_deserialization() -> None: assert len(scheme.attributes[0].attributes) == 1 -def test_extractionschemanode_without_type_cannot_be_deserialized() -> None: +def test_inconsistent_attribute_cannot_be_deserialized() -> None: + """Test if inconsistent attributes cannot be deserialized.""" + + # Here the examples are a mix of string and float, which should not be allowed json = """ { "id": "root_object", @@ -228,17 +180,12 @@ def test_extractionschemanode_without_type_cannot_be_deserialized() -> None: "description": "Description for Number", "many": true, "examples": [ - ["Here is 1 number", 1], - ["Here are 0 numbers", 0] + ["Here is 1 number", "true"], + ["Here are 0 numbers", 2.3] ] } ] } """ - if PYDANTIC_MAJOR_VERSION == 1: - exception_class: Type[Exception] = ValueError - else: - exception_class = NotImplementedError - - with pytest.raises(exception_class): - Object.parse_raw(json) + with pytest.raises(ValidationError): + loads(json) From b56fff72b720c06c1ee1ff16c723342a21c4961c Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:17:00 -0400 Subject: [PATCH 2/9] x --- kor/serializer.py | 2 +- tests/test_serialization.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/kor/serializer.py b/kor/serializer.py index 9558db9..246d4b3 100644 --- a/kor/serializer.py +++ b/kor/serializer.py @@ -1,8 +1,8 @@ +import json from typing import Optional from ._pydantic import PYDANTIC_MAJOR_VERSION from .nodes import Object -import json # PUBLIC API diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 6ded2a2..950fc13 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -1,11 +1,9 @@ """Test serialization and deserialization of nodes.""" -from typing import Any, Type import pytest from pydantic import ValidationError from kor import Bool, Number, Object, Selection, Text -from kor.nodes import ExtractionSchemaNode from kor.serializer import dumps, loads From f5424d050b6809aae2f375fddf9c06562512e07a Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:25:55 -0400 Subject: [PATCH 3/9] x --- tests/test_serialization.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 950fc13..466e0bc 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -5,6 +5,7 @@ from kor import Bool, Number, Object, Selection, Text from kor.serializer import dumps, loads +from kor._pydantic import PYDANTIC_MAJOR_VERSION def test_serialize_deserialize_equals() -> None: @@ -163,6 +164,7 @@ def test_nested_object_deserialization() -> None: assert len(scheme.attributes[0].attributes) == 1 +@pytest.mark.skipif(PYDANTIC_MAJOR_VERSION < 2, reason="Fails for pydantic v1") def test_inconsistent_attribute_cannot_be_deserialized() -> None: """Test if inconsistent attributes cannot be deserialized.""" From 31b15a8f92a6d620255f507fb6481c0a530ae84d Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:26:18 -0400 Subject: [PATCH 4/9] x --- tests/test_serialization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 466e0bc..9e26a99 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -4,8 +4,8 @@ from pydantic import ValidationError from kor import Bool, Number, Object, Selection, Text -from kor.serializer import dumps, loads from kor._pydantic import PYDANTIC_MAJOR_VERSION +from kor.serializer import dumps, loads def test_serialize_deserialize_equals() -> None: From 9de8e91d4c90fe47826e09a819cbaa38ed802399 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:36:42 -0400 Subject: [PATCH 5/9] x --- kor/_pydantic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kor/_pydantic.py b/kor/_pydantic.py index ca756dc..2b36e7f 100644 --- a/kor/_pydantic.py +++ b/kor/_pydantic.py @@ -7,8 +7,8 @@ def _get_pydantic_major_version() -> int: import pydantic return int(pydantic.__version__.split(".")[0]) - except ImportError: - return 0 + except (AttributeError, ValueError): + return 1 PYDANTIC_MAJOR_VERSION = _get_pydantic_major_version() From 7b6317f72193b0566cbfb12a64702b1650542c7e Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:40:53 -0400 Subject: [PATCH 6/9] x --- poetry.lock | 163 +++++++++++++++++++++------------------------------- 1 file changed, 64 insertions(+), 99 deletions(-) diff --git a/poetry.lock b/poetry.lock index 14acda4..dc93756 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "aiofiles" @@ -175,24 +175,24 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anyio" -version = "4.0.0" +version = "3.7.1" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false -python-versions = ">=3.8" +python-versions = ">=3.7" files = [ - {file = "anyio-4.0.0-py3-none-any.whl", hash = "sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f"}, - {file = "anyio-4.0.0.tar.gz", hash = "sha256:f7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a"}, + {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, + {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, ] [package.dependencies] -exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} +exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" [package.extras] -doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (>=0.22)"] +doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] +test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (<0.22)"] [[package]] name = "appnope" @@ -946,6 +946,7 @@ files = [ {file = "greenlet-2.0.2-cp27-cp27m-win32.whl", hash = "sha256:6c3acb79b0bfd4fe733dff8bc62695283b57949ebcca05ae5c129eb606ff2d74"}, {file = "greenlet-2.0.2-cp27-cp27m-win_amd64.whl", hash = "sha256:283737e0da3f08bd637b5ad058507e578dd462db259f7f6e4c5c365ba4ee9343"}, {file = "greenlet-2.0.2-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:d27ec7509b9c18b6d73f2f5ede2622441de812e7b1a80bbd446cb0633bd3d5ae"}, + {file = "greenlet-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d967650d3f56af314b72df7089d96cda1083a7fc2da05b375d2bc48c82ab3f3c"}, {file = "greenlet-2.0.2-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:30bcf80dda7f15ac77ba5af2b961bdd9dbc77fd4ac6105cee85b0d0a5fcf74df"}, {file = "greenlet-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26fbfce90728d82bc9e6c38ea4d038cba20b7faf8a0ca53a9c07b67318d46088"}, {file = "greenlet-2.0.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9190f09060ea4debddd24665d6804b995a9c122ef5917ab26e1566dcc712ceeb"}, @@ -954,6 +955,7 @@ files = [ {file = "greenlet-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:76ae285c8104046b3a7f06b42f29c7b73f77683df18c49ab5af7983994c2dd91"}, {file = "greenlet-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:2d4686f195e32d36b4d7cf2d166857dbd0ee9f3d20ae349b6bf8afc8485b3645"}, {file = "greenlet-2.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c4302695ad8027363e96311df24ee28978162cdcdd2006476c43970b384a244c"}, + {file = "greenlet-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d4606a527e30548153be1a9f155f4e283d109ffba663a15856089fb55f933e47"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c48f54ef8e05f04d6eff74b8233f6063cb1ed960243eacc474ee73a2ea8573ca"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a1846f1b999e78e13837c93c778dcfc3365902cfb8d1bdb7dd73ead37059f0d0"}, {file = "greenlet-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a06ad5312349fec0ab944664b01d26f8d1f05009566339ac6f63f56589bc1a2"}, @@ -983,6 +985,7 @@ files = [ {file = "greenlet-2.0.2-cp37-cp37m-win32.whl", hash = "sha256:3f6ea9bd35eb450837a3d80e77b517ea5bc56b4647f5502cd28de13675ee12f7"}, {file = "greenlet-2.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:7492e2b7bd7c9b9916388d9df23fa49d9b88ac0640db0a5b4ecc2b653bf451e3"}, {file = "greenlet-2.0.2-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:b864ba53912b6c3ab6bcb2beb19f19edd01a6bfcbdfe1f37ddd1778abfe75a30"}, + {file = "greenlet-2.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1087300cf9700bbf455b1b97e24db18f2f77b55302a68272c56209d5587c12d1"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:ba2956617f1c42598a308a84c6cf021a90ff3862eddafd20c3333d50f0edb45b"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc3a569657468b6f3fb60587e48356fe512c1754ca05a564f11366ac9e306526"}, {file = "greenlet-2.0.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8eab883b3b2a38cc1e050819ef06a7e6344d4a990d24d45bc6f2cf959045a45b"}, @@ -991,6 +994,7 @@ files = [ {file = "greenlet-2.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b0ef99cdbe2b682b9ccbb964743a6aca37905fda5e0452e5ee239b1654d37f2a"}, {file = "greenlet-2.0.2-cp38-cp38-win32.whl", hash = "sha256:b80f600eddddce72320dbbc8e3784d16bd3fb7b517e82476d8da921f27d4b249"}, {file = "greenlet-2.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:4d2e11331fc0c02b6e84b0d28ece3a36e0548ee1a1ce9ddde03752d9b79bba40"}, + {file = "greenlet-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8512a0c38cfd4e66a858ddd1b17705587900dd760c6003998e9472b77b56d417"}, {file = "greenlet-2.0.2-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:88d9ab96491d38a5ab7c56dd7a3cc37d83336ecc564e4e8816dbed12e5aaefc8"}, {file = "greenlet-2.0.2-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:561091a7be172ab497a3527602d467e2b3fbe75f9e783d8b8ce403fa414f71a6"}, {file = "greenlet-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:971ce5e14dc5e73715755d0ca2975ac88cfdaefcaab078a284fea6cfabf866df"}, @@ -1224,6 +1228,20 @@ files = [ [package.extras] dev = ["hypothesis"] +[[package]] +name = "jsonpatch" +version = "1.33" +description = "Apply JSON-Patches (RFC 6902)" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" +files = [ + {file = "jsonpatch-1.33-py2.py3-none-any.whl", hash = "sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade"}, + {file = "jsonpatch-1.33.tar.gz", hash = "sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c"}, +] + +[package.dependencies] +jsonpointer = ">=1.9" + [[package]] name = "jsonpointer" version = "2.4" @@ -1232,6 +1250,7 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" files = [ {file = "jsonpointer-2.4-py2.py3-none-any.whl", hash = "sha256:15d51bba20eea3165644553647711d150376234112651b4f1811022aecad7d7a"}, + {file = "jsonpointer-2.4.tar.gz", hash = "sha256:585cee82b70211fa9e6043b7bb89db6e1aa49524340dde8ad6b63206ea689d88"}, ] [[package]] @@ -1554,21 +1573,22 @@ test = ["hatch", "ipykernel", "jupyterlab-server[openapi]", "openapi-spec-valida [[package]] name = "langchain" -version = "0.0.283" +version = "0.0.310" description = "Building applications with LLMs through composability" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.283-py3-none-any.whl", hash = "sha256:bf0e646340fa38bdc6e035aecaaac4fd28befaab3638ec7891556676bedd1935"}, - {file = "langchain-0.0.283.tar.gz", hash = "sha256:1c9d919cabc90c6371c1fa5e080b546f72e0c6fd022c9108835a84cd51777d21"}, + {file = "langchain-0.0.310-py3-none-any.whl", hash = "sha256:d24e2d417f4a3736a73d409827ad3455168a31901ca8724d39b17a287a8185e9"}, + {file = "langchain-0.0.310.tar.gz", hash = "sha256:71e2de02742517ea981cd185c258972d82e87693191fc8745947312888364e22"}, ] [package.dependencies] aiohttp = ">=3.8.3,<4.0.0" +anyio = "<4.0" async-timeout = {version = ">=4.0.0,<5.0.0", markers = "python_version < \"3.11\""} -dataclasses-json = ">=0.5.7,<0.6.0" -langsmith = ">=0.0.21,<0.1.0" -numexpr = ">=2.8.4,<3.0.0" +dataclasses-json = ">=0.5.7,<0.7" +jsonpatch = ">=1.33,<2.0" +langsmith = ">=0.0.40,<0.1.0" numpy = ">=1,<2" pydantic = ">=1,<3" PyYAML = ">=5.3" @@ -1577,28 +1597,29 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "amadeus (>=8.1.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "awadb (>=0.3.9,<0.4.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clarifai (>=9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=4,<5)", "deeplake (>=3.6.8,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.6,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "libdeeplake (>=0.0.60,<0.0.61)", "librosa (>=0.10.0.post2,<0.11.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "marqo (>=1.2.4,<2.0.0)", "momento (>=1.5.0,<2.0.0)", "nebula3-python (>=3.4.0,<4.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<3.0.0)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pymongo (>=4.3.3,<5.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "python-arango (>=7.5.9,<8.0.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.3.1,<2.0.0)", "rdflib (>=6.3.2,<7.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "singlestoredb (>=0.7.1,<0.8.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.0.0)", "tiktoken (>=0.3.2,<0.4.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] +all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "amadeus (>=8.1.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "awadb (>=0.3.9,<0.4.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clarifai (>=9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=4,<5)", "deeplake (>=3.6.8,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.6,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "libdeeplake (>=0.0.60,<0.0.61)", "librosa (>=0.10.0.post2,<0.11.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "marqo (>=1.2.4,<2.0.0)", "momento (>=1.5.0,<2.0.0)", "nebula3-python (>=3.4.0,<4.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<4)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pymongo (>=4.3.3,<5.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "python-arango (>=7.5.9,<8.0.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.3.1,<2.0.0)", "rdflib (>=6.3.2,<7.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "singlestoredb (>=0.7.1,<0.8.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.0.0)", "tiktoken (>=0.3.2,<0.6.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "azure-search-documents (==11.4.0b8)", "openai (>=0,<1)"] clarifai = ["clarifai (>=9.1.0)"] +cli = ["typer (>=0.9.0,<0.10.0)"] cohere = ["cohere (>=4,<5)"] docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["amazon-textract-caller (<2)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "dashvector (>=1.0.1,<2.0.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "openai (>=0,<1)", "openapi-schema-pydantic (>=1.2,<2.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "tqdm (>=4.48.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)"] +extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "amazon-textract-caller (<2)", "anthropic (>=0.3.11,<0.4.0)", "arxiv (>=1.4,<2.0)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "dashvector (>=1.0.1,<2.0.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "motor (>=3.3.1,<4.0.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "numexpr (>=2.8.6,<3.0.0)", "openai (>=0,<1)", "openapi-schema-pydantic (>=1.2,<2.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "rapidocr-onnxruntime (>=1.3.2,<2.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "timescale-vector (>=0.0.1,<0.0.2)", "tqdm (>=4.48.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)"] javascript = ["esprima (>=4.0.1,<5.0.0)"] llms = ["clarifai (>=9.1.0)", "cohere (>=4,<5)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] -openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.4.0)"] +openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.6.0)"] qdrant = ["qdrant-client (>=1.3.1,<2.0.0)"] text-helpers = ["chardet (>=5.1.0,<6.0.0)"] [[package]] name = "langsmith" -version = "0.0.33" +version = "0.0.43" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langsmith-0.0.33-py3-none-any.whl", hash = "sha256:cdff11a6272d3cba72c151960c0319b1d36e0770d37f05061d6c31ef1a2404a4"}, - {file = "langsmith-0.0.33.tar.gz", hash = "sha256:c9c640ac238d4cabc8f9744e04346d3dfaf0ca6c9dc37bd2a25b8031eda35dc3"}, + {file = "langsmith-0.0.43-py3-none-any.whl", hash = "sha256:27854bebdae6a35c88e1c1172e6abba27592287b70511aca2a953a59fade0e87"}, + {file = "langsmith-0.0.43.tar.gz", hash = "sha256:f7705f13eb8ce3b8eb16c4d2b2760c62cfb9a3b3ab6aa0728afa84d26b2a6e55"}, ] [package.dependencies] @@ -1702,6 +1723,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -2218,48 +2249,6 @@ jupyter-server = ">=1.8,<3" [package.extras] test = ["pytest", "pytest-console-scripts", "pytest-jupyter", "pytest-tornasync"] -[[package]] -name = "numexpr" -version = "2.8.5" -description = "Fast numerical expression evaluator for NumPy" -optional = false -python-versions = ">=3.7" -files = [ - {file = "numexpr-2.8.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51f3ab160c3847ebcca93cd88f935a7802b54a01ab63fe93152994a64d7a6cf2"}, - {file = "numexpr-2.8.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:de29c77f674e4eb8f0846525a475cab64008c227c8bc4ba5153ab3f72441cc63"}, - {file = "numexpr-2.8.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf85ba1327eb87ec82ae7936f13c8850fb969a0ca34f3ba9fa3897c09d5c80d7"}, - {file = "numexpr-2.8.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c00be69f747f44a631830215cab482f0f77f75af2925695adff57c1cc0f9a68"}, - {file = "numexpr-2.8.5-cp310-cp310-win32.whl", hash = "sha256:c46350dcdb93e32f033eea5a21269514ffcaf501d9abd6036992d37e48a308b0"}, - {file = "numexpr-2.8.5-cp310-cp310-win_amd64.whl", hash = "sha256:894b027438b8ec88dea32a19193716c79f4ff8ddb92302dcc9731b51ba3565a8"}, - {file = "numexpr-2.8.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6df184d40d4cf9f21c71f429962f39332f7398147762588c9f3a5c77065d0c06"}, - {file = "numexpr-2.8.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:178b85ad373c6903e55d75787d61b92380439b70d94b001cb055a501b0821335"}, - {file = "numexpr-2.8.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:578fe4008e4d5d6ff01bbeb2d7b7ba1ec658a5cda9c720cd26a9a8325f8ef438"}, - {file = "numexpr-2.8.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef621b4ee366a5c6a484f6678c9259f5b826569f8bfa0b89ba2306d5055468bb"}, - {file = "numexpr-2.8.5-cp311-cp311-win32.whl", hash = "sha256:dd57ab1a3d3aaa9274aff1cefbf93b8ddacc7973afef5b125905f6bf18fabab0"}, - {file = "numexpr-2.8.5-cp311-cp311-win_amd64.whl", hash = "sha256:783324ba40eb804ecfc9ebae86120a1e339ab112d0ab8a1f0d48a26354d5bf9b"}, - {file = "numexpr-2.8.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:183d5430db76826e54465c69db93a3c6ecbf03cda5aa1bb96eaad0147e9b68dc"}, - {file = "numexpr-2.8.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39ce106f92ccea5b07b1d6f2f3c4370f05edf27691dc720a63903484a2137e48"}, - {file = "numexpr-2.8.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b594dc9e2d6291a0bc5c065e6d9caf3eee743b5663897832e9b17753c002947a"}, - {file = "numexpr-2.8.5-cp37-cp37m-win32.whl", hash = "sha256:62b4faf8e0627673b0210a837792bddd23050ecebc98069ab23eb0633ff1ef5f"}, - {file = "numexpr-2.8.5-cp37-cp37m-win_amd64.whl", hash = "sha256:db5c65417d69414f1ab31302ea01d3548303ef31209c38b4849d145be4e1d1ba"}, - {file = "numexpr-2.8.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:eb36ffcfa1606e41aa08d559b4277bcad0e16b83941d1a4fee8d2bd5a34f8e0e"}, - {file = "numexpr-2.8.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:34af2a0e857d02a4bc5758bc037a777d50dacb13bcd57c7905268a3e44994ed6"}, - {file = "numexpr-2.8.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5a8dad2bfaad5a5c34a2e8bbf62b9df1dfab266d345fda1feb20ff4e264b347a"}, - {file = "numexpr-2.8.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b93f5a866cd13a808bc3d3a9c487d94cd02eec408b275ff0aa150f2e8e5191f8"}, - {file = "numexpr-2.8.5-cp38-cp38-win32.whl", hash = "sha256:558390fea6370003ac749ed9d0f38d708aa096f5dcb707ddb6e0ca5a0dd37da1"}, - {file = "numexpr-2.8.5-cp38-cp38-win_amd64.whl", hash = "sha256:55983806815035eb63c5039520688c49536bb7f3cc3fc1d7d64c6a00cf3f353e"}, - {file = "numexpr-2.8.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1510da20e6f5f45333610b1ded44c566e2690c6c437c84f2a212ca09627c7e01"}, - {file = "numexpr-2.8.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9e8b5bf7bcb4e8dcd66522d8fc96e1db7278f901cb4fd2e155efbe62a41dde08"}, - {file = "numexpr-2.8.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ed0e1c1ef5f34381448539f1fe9015906d21c9cfa2797c06194d4207dadb465"}, - {file = "numexpr-2.8.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aea6ab45c87c0a7041183c08a798f0ad4d7c5eccbce20cfe79ce6f1a45ef3702"}, - {file = "numexpr-2.8.5-cp39-cp39-win32.whl", hash = "sha256:cbfd833ee5fdb0efb862e152aee7e6ccea9c596d5c11d22604c2e6307bff7cad"}, - {file = "numexpr-2.8.5-cp39-cp39-win_amd64.whl", hash = "sha256:283ce8609a7ccbadf91a68f3484558b3e36d27c93c98a41ec205efb0ab43c872"}, - {file = "numexpr-2.8.5.tar.gz", hash = "sha256:45ed41e55a0abcecf3d711481e12a5fb7a904fe99d42bc282a17cc5f8ea510be"}, -] - -[package.dependencies] -numpy = ">=1.13.3" - [[package]] name = "numpy" version = "1.24.4" @@ -2297,40 +2286,6 @@ files = [ {file = "numpy-1.24.4.tar.gz", hash = "sha256:80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463"}, ] -[[package]] -name = "numpy" -version = "1.25.2" -description = "Fundamental package for array computing in Python" -optional = false -python-versions = ">=3.9" -files = [ - {file = "numpy-1.25.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:db3ccc4e37a6873045580d413fe79b68e47a681af8db2e046f1dacfa11f86eb3"}, - {file = "numpy-1.25.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:90319e4f002795ccfc9050110bbbaa16c944b1c37c0baeea43c5fb881693ae1f"}, - {file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfe4a913e29b418d096e696ddd422d8a5d13ffba4ea91f9f60440a3b759b0187"}, - {file = "numpy-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f08f2e037bba04e707eebf4bc934f1972a315c883a9e0ebfa8a7756eabf9e357"}, - {file = "numpy-1.25.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bec1e7213c7cb00d67093247f8c4db156fd03075f49876957dca4711306d39c9"}, - {file = "numpy-1.25.2-cp310-cp310-win32.whl", hash = "sha256:7dc869c0c75988e1c693d0e2d5b26034644399dd929bc049db55395b1379e044"}, - {file = "numpy-1.25.2-cp310-cp310-win_amd64.whl", hash = "sha256:834b386f2b8210dca38c71a6e0f4fd6922f7d3fcff935dbe3a570945acb1b545"}, - {file = "numpy-1.25.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c5462d19336db4560041517dbb7759c21d181a67cb01b36ca109b2ae37d32418"}, - {file = "numpy-1.25.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c5652ea24d33585ea39eb6a6a15dac87a1206a692719ff45d53c5282e66d4a8f"}, - {file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d60fbae8e0019865fc4784745814cff1c421df5afee233db6d88ab4f14655a2"}, - {file = "numpy-1.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60e7f0f7f6d0eee8364b9a6304c2845b9c491ac706048c7e8cf47b83123b8dbf"}, - {file = "numpy-1.25.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bb33d5a1cf360304754913a350edda36d5b8c5331a8237268c48f91253c3a364"}, - {file = "numpy-1.25.2-cp311-cp311-win32.whl", hash = "sha256:5883c06bb92f2e6c8181df7b39971a5fb436288db58b5a1c3967702d4278691d"}, - {file = "numpy-1.25.2-cp311-cp311-win_amd64.whl", hash = "sha256:5c97325a0ba6f9d041feb9390924614b60b99209a71a69c876f71052521d42a4"}, - {file = "numpy-1.25.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b79e513d7aac42ae918db3ad1341a015488530d0bb2a6abcbdd10a3a829ccfd3"}, - {file = "numpy-1.25.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:eb942bfb6f84df5ce05dbf4b46673ffed0d3da59f13635ea9b926af3deb76926"}, - {file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e0746410e73384e70d286f93abf2520035250aad8c5714240b0492a7302fdca"}, - {file = "numpy-1.25.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7806500e4f5bdd04095e849265e55de20d8cc4b661b038957354327f6d9b295"}, - {file = "numpy-1.25.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8b77775f4b7df768967a7c8b3567e309f617dd5e99aeb886fa14dc1a0791141f"}, - {file = "numpy-1.25.2-cp39-cp39-win32.whl", hash = "sha256:2792d23d62ec51e50ce4d4b7d73de8f67a2fd3ea710dcbc8563a51a03fb07b01"}, - {file = "numpy-1.25.2-cp39-cp39-win_amd64.whl", hash = "sha256:76b4115d42a7dfc5d485d358728cdd8719be33cc5ec6ec08632a5d6fca2ed380"}, - {file = "numpy-1.25.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1a1329e26f46230bf77b02cc19e900db9b52f398d6722ca853349a782d4cff55"}, - {file = "numpy-1.25.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c3abc71e8b6edba80a01a52e66d83c5d14433cbcd26a40c329ec7ed09f37901"}, - {file = "numpy-1.25.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1b9735c27cea5d995496f46a8b1cd7b408b3f34b6d50459d9ac8fe3a20cc17bf"}, - {file = "numpy-1.25.2.tar.gz", hash = "sha256:fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760"}, -] - [[package]] name = "overrides" version = "7.4.0" @@ -2392,8 +2347,8 @@ files = [ [package.dependencies] numpy = [ {version = ">=1.20.3", markers = "python_version < \"3.10\""}, - {version = ">=1.21.0", markers = "python_version >= \"3.10\""}, {version = ">=1.23.2", markers = "python_version >= \"3.11\""}, + {version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""}, ] python-dateutil = ">=2.8.1" pytz = ">=2020.1" @@ -2922,6 +2877,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2929,8 +2885,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2947,6 +2910,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2954,6 +2918,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3618,7 +3583,7 @@ files = [ ] [package.dependencies] -greenlet = {version = "!=0.4.17", markers = "platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\""} +greenlet = {version = "!=0.4.17", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""} typing-extensions = ">=4.2.0" [package.extras] From 64d281e9bb1db5cb4910a00300a18cf92553e4b1 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 16:45:50 -0400 Subject: [PATCH 7/9] x --- kor/nodes.py | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/kor/nodes.py b/kor/nodes.py index fe9a567..5dfbc05 100644 --- a/kor/nodes.py +++ b/kor/nodes.py @@ -93,25 +93,9 @@ def replace( class ExtractionSchemaNode(AbstractSchemaNode, abc.ABC): """An abstract definition for inputs that involve extraction. - An extraction input can be associated with extraction examples. - - An extraction example is a 2-tuple composed of a text segment and the expected - extraction. - - For example: - - .. code-block:: python - - [ - ("I bought this cookie for $10", "$10"), - ("Eggs cost twelve dollars", "twelve dollars"), - ] + Used for organizing the schema. """ - examples: Sequence[ - Tuple[str, Union[bool, int, float, str, Sequence[Union[str, int, float, bool]]]] - ] = tuple() - class Number(ExtractionSchemaNode): """Built-in number input.""" @@ -120,7 +104,7 @@ class Number(ExtractionSchemaNode): Tuple[str, Union[int, float, Sequence[Union[float, int]]]] ] = tuple() - type: Literal["number"] = "number" + type_: Literal["number"] = "number" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -131,7 +115,7 @@ class Text(ExtractionSchemaNode): """Built-in text input.""" examples: Sequence[Tuple[str, Union[Sequence[str], str]]] = tuple() - type: Literal["text"] = "text" + type_: Literal["text"] = "text" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -142,7 +126,7 @@ class Bool(ExtractionSchemaNode): """Built-in bool input.""" examples: Sequence[Tuple[str, Union[Sequence[bool], bool]]] = tuple() - type: Literal["bool"] = "bool" + type_: Literal["bool"] = "bool" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -153,7 +137,7 @@ class Option(AbstractSchemaNode): """Built-in option input must be part of a selection input.""" examples: Sequence[str] = tuple() - type: Literal["option"] = "option" + type_: Literal["option"] = "option" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -196,7 +180,7 @@ class Selection(AbstractSchemaNode): options: Sequence[Option] examples: Sequence[Tuple[str, Union[str, Sequence[str]]]] = tuple() null_examples: Sequence[str] = tuple() - type: Literal["selection"] = "selection" + type_: Literal["selection"] = "selection" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -231,7 +215,7 @@ class Object(AbstractSchemaNode): """ attributes: Sequence[Union[Selection, Object, Number, Text, Bool]] - type: Literal["object"] = "object" + type_: Literal["object"] = "object" examples: Sequence[ Tuple[ From b82772561d65c2ea25c9d36e05d4fc8901e4fd42 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 17:01:29 -0400 Subject: [PATCH 8/9] x --- kor/nodes.py | 30 +++++++++++++++++++++++------- kor/serializer.py | 8 ++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/kor/nodes.py b/kor/nodes.py index 5dfbc05..fe9a567 100644 --- a/kor/nodes.py +++ b/kor/nodes.py @@ -93,9 +93,25 @@ def replace( class ExtractionSchemaNode(AbstractSchemaNode, abc.ABC): """An abstract definition for inputs that involve extraction. - Used for organizing the schema. + An extraction input can be associated with extraction examples. + + An extraction example is a 2-tuple composed of a text segment and the expected + extraction. + + For example: + + .. code-block:: python + + [ + ("I bought this cookie for $10", "$10"), + ("Eggs cost twelve dollars", "twelve dollars"), + ] """ + examples: Sequence[ + Tuple[str, Union[bool, int, float, str, Sequence[Union[str, int, float, bool]]]] + ] = tuple() + class Number(ExtractionSchemaNode): """Built-in number input.""" @@ -104,7 +120,7 @@ class Number(ExtractionSchemaNode): Tuple[str, Union[int, float, Sequence[Union[float, int]]]] ] = tuple() - type_: Literal["number"] = "number" + type: Literal["number"] = "number" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -115,7 +131,7 @@ class Text(ExtractionSchemaNode): """Built-in text input.""" examples: Sequence[Tuple[str, Union[Sequence[str], str]]] = tuple() - type_: Literal["text"] = "text" + type: Literal["text"] = "text" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -126,7 +142,7 @@ class Bool(ExtractionSchemaNode): """Built-in bool input.""" examples: Sequence[Tuple[str, Union[Sequence[bool], bool]]] = tuple() - type_: Literal["bool"] = "bool" + type: Literal["bool"] = "bool" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -137,7 +153,7 @@ class Option(AbstractSchemaNode): """Built-in option input must be part of a selection input.""" examples: Sequence[str] = tuple() - type_: Literal["option"] = "option" + type: Literal["option"] = "option" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -180,7 +196,7 @@ class Selection(AbstractSchemaNode): options: Sequence[Option] examples: Sequence[Tuple[str, Union[str, Sequence[str]]]] = tuple() null_examples: Sequence[str] = tuple() - type_: Literal["selection"] = "selection" + type: Literal["selection"] = "selection" def accept(self, visitor: AbstractVisitor[T], **kwargs: Any) -> T: """Accept a visitor.""" @@ -215,7 +231,7 @@ class Object(AbstractSchemaNode): """ attributes: Sequence[Union[Selection, Object, Number, Text, Bool]] - type_: Literal["object"] = "object" + type: Literal["object"] = "object" examples: Sequence[ Tuple[ diff --git a/kor/serializer.py b/kor/serializer.py index 246d4b3..741bd30 100644 --- a/kor/serializer.py +++ b/kor/serializer.py @@ -10,8 +10,8 @@ def loads(string: str) -> Object: """Deserialize a string to a schema node.""" if PYDANTIC_MAJOR_VERSION == 1: - return Object.parse_raw(string) - return Object.model_validate_json(string) + return Object.parse_raw(string) # type: ignore[attr-defined] + return Object.model_validate_json(string) # type: ignore[attr-defined] def dumps( @@ -19,8 +19,8 @@ def dumps( ) -> str: """Serialize a schema node to a string.""" if PYDANTIC_MAJOR_VERSION == 1: - d = object.dict() + d = object.dict() # type: ignore[attr-defined] else: - d = object.model_dump() + d = object.model_dump() # type: ignore[attr-defined] return json.dumps(d, indent=indent, sort_keys=sort_keys) From ffff6c17c3a53e868550c56e5f19cd75d2223e01 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 6 Oct 2023 17:02:28 -0400 Subject: [PATCH 9/9] x --- kor/_pydantic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kor/_pydantic.py b/kor/_pydantic.py index 2b36e7f..ca756dc 100644 --- a/kor/_pydantic.py +++ b/kor/_pydantic.py @@ -7,8 +7,8 @@ def _get_pydantic_major_version() -> int: import pydantic return int(pydantic.__version__.split(".")[0]) - except (AttributeError, ValueError): - return 1 + except ImportError: + return 0 PYDANTIC_MAJOR_VERSION = _get_pydantic_major_version()