Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 1.66.0 #705

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.65.0"
".": "1.66.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 69
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-a671c20108a4aaebd22f105a7184bd9083b0cd8ba076f64a88c22498113be4af.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-885b7738bc5f69e484fd0738024e7560f5f5448aee76017f27e78e1fe2485ae0.yml
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 1.66.0 (2024-12-13)

Full Changelog: [v1.65.0...v1.66.0](https://github.com/StructifyAI/structify-python/compare/v1.65.0...v1.66.0)

### Features

* **api:** api update ([#706](https://github.com/StructifyAI/structify-python/issues/706)) ([721ca3c](https://github.com/StructifyAI/structify-python/commit/721ca3ce0fdf11cd71fffd5544b69c6d8102892e))
* **api:** api update ([#707](https://github.com/StructifyAI/structify-python/issues/707)) ([c4b740b](https://github.com/StructifyAI/structify-python/commit/c4b740bbb52b68997242b0e7c9fcc42300d0a950))
* **api:** api update ([#708](https://github.com/StructifyAI/structify-python/issues/708)) ([c0cae13](https://github.com/StructifyAI/structify-python/commit/c0cae13f26f5f44fc6b625d87380e1a9fc5c6442))


### Chores

* **internal:** codegen related update ([#704](https://github.com/StructifyAI/structify-python/issues/704)) ([6979780](https://github.com/StructifyAI/structify-python/commit/697978007a134ef0b5780a9fa8ecc3b77424c660))

## 1.65.0 (2024-12-12)

Full Changelog: [v1.64.0...v1.65.0](https://github.com/StructifyAI/structify-python/compare/v1.64.0...v1.65.0)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ Types:
from structify.types import (
DatasetDescriptor,
Entity,
Image,
KnowledgeGraph,
PropertyType,
Relationship,
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "structifyai"
version = "1.65.0"
version = "1.66.0"
description = "The official Python library for the structify API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -10,7 +10,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.7, <5",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.389
pyright==1.1.390
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down
3 changes: 3 additions & 0 deletions src/structify/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
strip_not_given,
extract_type_arg,
is_annotated_type,
is_type_alias_type,
strip_annotated_type,
)
from ._compat import (
Expand Down Expand Up @@ -428,6 +429,8 @@ def construct_type(*, value: object, type_: object) -> object:
# we allow `object` as the input type because otherwise, passing things like
# `Literal['value']` will be reported as a type error by type checkers
type_ = cast("type[object]", type_)
if is_type_alias_type(type_):
type_ = type_.__value__ # type: ignore[unreachable]

# unwrap `Annotated[T, ...]` -> `T`
if is_annotated_type(type_):
Expand Down
20 changes: 10 additions & 10 deletions src/structify/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pydantic

from ._types import NoneType
from ._utils import is_given, extract_type_arg, is_annotated_type, extract_type_var_from_base
from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base
from ._models import BaseModel, is_basemodel
from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER
from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type
Expand Down Expand Up @@ -126,9 +126,15 @@ def __repr__(self) -> str:
)

def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to = to if to is not None else self._cast_to

# unwrap `TypeAlias('Name', T)` -> `T`
if is_type_alias_type(cast_to):
cast_to = cast_to.__value__ # type: ignore[unreachable]

# unwrap `Annotated[T, ...]` -> `T`
if to and is_annotated_type(to):
to = extract_type_arg(to, 0)
if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)

if self._is_sse_stream:
if to:
Expand Down Expand Up @@ -164,18 +170,12 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
return cast(
R,
stream_cls(
cast_to=self._cast_to,
cast_to=cast_to,
response=self.http_response,
client=cast(Any, self._client),
),
)

cast_to = to if to is not None else self._cast_to

# unwrap `Annotated[T, ...]` -> `T`
if is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0)

if cast_to is NoneType:
return cast(R, None)

Expand Down
1 change: 1 addition & 0 deletions src/structify/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
is_iterable_type as is_iterable_type,
is_required_type as is_required_type,
is_annotated_type as is_annotated_type,
is_type_alias_type as is_type_alias_type,
strip_annotated_type as strip_annotated_type,
extract_type_var_from_base as extract_type_var_from_base,
)
Expand Down
31 changes: 30 additions & 1 deletion src/structify/_utils/_typing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from __future__ import annotations

import sys
import typing
import typing_extensions
from typing import Any, TypeVar, Iterable, cast
from collections import abc as _c_abc
from typing_extensions import Required, Annotated, get_args, get_origin
from typing_extensions import (
TypeIs,
Required,
Annotated,
get_args,
get_origin,
)

from .._types import InheritsGeneric
from .._compat import is_union as _is_union
Expand Down Expand Up @@ -36,6 +45,26 @@ def is_typevar(typ: type) -> bool:
return type(typ) == TypeVar # type: ignore


_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,)
if sys.version_info >= (3, 12):
_TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType)


def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
"""Return whether the provided argument is an instance of `TypeAliasType`.

```python
type Int = int
is_type_alias_type(Int)
# > True
Str = TypeAliasType("Str", str)
is_type_alias_type(Str)
# > True
```
"""
return isinstance(tp, _TYPE_ALIAS_TYPES)


# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
def strip_annotated_type(typ: type) -> type:
if is_required_type(typ) or is_annotated_type(typ):
Expand Down
2 changes: 1 addition & 1 deletion src/structify/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "structify"
__version__ = "1.65.0" # x-release-please-version
__version__ = "1.66.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/structify/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

from __future__ import annotations

from .image import Image as Image
from .table import Table as Table
from .entity import Entity as Entity
from .source import Source as Source
from .user_info import UserInfo as UserInfo
from .chat_prompt import ChatPrompt as ChatPrompt
from .image_param import ImageParam as ImageParam
from .table_param import TableParam as TableParam
from .entity_param import EntityParam as EntityParam
from .relationship import Relationship as Relationship
Expand Down
2 changes: 2 additions & 0 deletions src/structify/types/admin/human_llm_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Job(BaseModel):

message: Optional[str] = None

reason: Optional[str] = None

report_on_complete: Optional[bool] = None

run_started_time: Optional[datetime] = None
Expand Down
14 changes: 4 additions & 10 deletions src/structify/types/dataset_match_response.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Union, Optional
from typing import Dict, Union
from datetime import datetime
from typing_extensions import TypeAlias

from .image import Image
from .._models import BaseModel

__all__ = ["DatasetMatchResponse", "Entity", "EntityProperties", "EntityPropertiesImage"]
__all__ = ["DatasetMatchResponse", "Entity", "EntityProperties"]


class EntityPropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


EntityProperties: TypeAlias = Union[str, bool, float, EntityPropertiesImage]
EntityProperties: TypeAlias = Union[str, bool, float, Image]


class Entity(BaseModel):
Expand Down
14 changes: 4 additions & 10 deletions src/structify/types/dataset_view_relationships_response.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Union, Optional
from typing import Dict, Union
from typing_extensions import TypeAlias

from .image import Image
from .._models import BaseModel

__all__ = ["DatasetViewRelationshipsResponse", "Properties", "PropertiesImage"]
__all__ = ["DatasetViewRelationshipsResponse", "Properties"]


class PropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


Properties: TypeAlias = Union[str, bool, float, PropertiesImage]
Properties: TypeAlias = Union[str, bool, float, Image]


class DatasetViewRelationshipsResponse(BaseModel):
Expand Down
14 changes: 4 additions & 10 deletions src/structify/types/dataset_view_table_response.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Union, Optional
from typing import Dict, Union
from datetime import datetime
from typing_extensions import TypeAlias

from .image import Image
from .._models import BaseModel

__all__ = ["DatasetViewTableResponse", "Properties", "PropertiesImage"]
__all__ = ["DatasetViewTableResponse", "Properties"]


class PropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


Properties: TypeAlias = Union[str, bool, float, PropertiesImage]
Properties: TypeAlias = Union[str, bool, float, Image]


class DatasetViewTableResponse(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, List, Union, Optional
from typing import Dict, List, Union
from datetime import datetime
from typing_extensions import TypeAlias

from .image import Image
from .._models import BaseModel

__all__ = [
"DatasetViewTablesWithRelationshipsResponse",
"ConnectedEntity",
"ConnectedEntityProperties",
"ConnectedEntityPropertiesImage",
"Entity",
"EntityProperties",
"EntityPropertiesImage",
"Relationship",
"RelationshipProperties",
"RelationshipPropertiesImage",
]


class ConnectedEntityPropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


ConnectedEntityProperties: TypeAlias = Union[str, bool, float, ConnectedEntityPropertiesImage]
ConnectedEntityProperties: TypeAlias = Union[str, bool, float, Image]


class ConnectedEntity(BaseModel):
Expand All @@ -39,13 +30,7 @@ class ConnectedEntity(BaseModel):
properties: Dict[str, ConnectedEntityProperties]


class EntityPropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


EntityProperties: TypeAlias = Union[str, bool, float, EntityPropertiesImage]
EntityProperties: TypeAlias = Union[str, bool, float, Image]


class Entity(BaseModel):
Expand All @@ -58,13 +43,7 @@ class Entity(BaseModel):
properties: Dict[str, EntityProperties]


class RelationshipPropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


RelationshipProperties: TypeAlias = Union[str, bool, float, RelationshipPropertiesImage]
RelationshipProperties: TypeAlias = Union[str, bool, float, Image]


class Relationship(BaseModel):
Expand Down
14 changes: 4 additions & 10 deletions src/structify/types/entity.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Union, Optional
from typing import Dict, Union
from typing_extensions import TypeAlias

from .image import Image
from .._models import BaseModel

__all__ = ["Entity", "Properties", "PropertiesImage"]
__all__ = ["Entity", "Properties"]


class PropertiesImage(BaseModel):
number: int

hash: Optional[str] = None


Properties: TypeAlias = Union[str, bool, float, PropertiesImage]
Properties: TypeAlias = Union[str, bool, float, Image]


class Entity(BaseModel):
Expand Down
Loading
Loading