Skip to content

Commit 52566fe

Browse files
feat(api): update via SDK Studio (#67)
1 parent 78195d4 commit 52566fe

File tree

10 files changed

+240
-45
lines changed

10 files changed

+240
-45
lines changed

.github/workflows/create-releases.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/publish-pypi.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# workflow for re-running publishing to PyPI in case it fails for some reason
2-
# you can run this workflow by navigating to https://www.github.com/hyperspell/python-sdk/actions/workflows/publish-pypi.yml
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/hyperspell/python-sdk/actions/workflows/publish-pypi.yml
34
name: Publish PyPI
45
on:
56
workflow_dispatch:
67

8+
release:
9+
types: [published]
10+
711
jobs:
812
publish:
913
name: publish

.github/workflows/release-doctor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
2221
PYPI_TOKEN: ${{ secrets.HYPERSPELL_PYPI_TOKEN || secrets.PYPI_TOKEN }}

api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Shared Types
2+
3+
```python
4+
from hyperspell.types import Apikey, App, Collection
5+
```
6+
17
# Documents
28

39
Types:

bin/check-release-environment

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
errors=()
44

5-
if [ -z "${STAINLESS_API_KEY}" ]; then
6-
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
7-
fi
8-
95
if [ -z "${PYPI_TOKEN}" ]; then
106
errors+=("The HYPERSPELL_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
117
fi

src/hyperspell/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from .token import Token as Token
66
from .scores import Scores as Scores
7+
from .shared import App as App, Apikey as Apikey, Collection as Collection
78
from .document import Document as Document
89
from .collection import Collection as Collection
910
from .document_status import DocumentStatus as DocumentStatus
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .app import App as App
4+
from .apikey import Apikey as Apikey
5+
from .collection import Collection as Collection
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import List, Optional
6+
from datetime import datetime
7+
from typing_extensions import Literal
8+
9+
from ..._compat import PYDANTIC_V2
10+
from ..._models import BaseModel
11+
12+
__all__ = ["Apikey"]
13+
14+
15+
class Apikey(BaseModel):
16+
app_id: int
17+
18+
scopes: List[Literal["all", "ingest", "query"]]
19+
20+
secret: str
21+
22+
id: Optional[int] = None
23+
24+
app: Optional["App"] = None
25+
"""Apps Base Schema."""
26+
27+
created_at: Optional[datetime] = None
28+
29+
label: Optional[str] = None
30+
31+
revoked_at: Optional[datetime] = None
32+
33+
34+
from .app import App
35+
36+
if PYDANTIC_V2:
37+
Apikey.model_rebuild()
38+
else:
39+
Apikey.update_forward_refs() # type: ignore

src/hyperspell/types/shared/app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import List, Optional
6+
from datetime import datetime
7+
8+
from ..._compat import PYDANTIC_V2
9+
from ..._models import BaseModel
10+
11+
__all__ = ["App"]
12+
13+
14+
class App(BaseModel):
15+
name: str
16+
17+
slug: str
18+
19+
user_id: str
20+
21+
id: Optional[int] = None
22+
23+
api_keys: Optional[List["Apikey"]] = None
24+
25+
collections: Optional[List["Collection"]] = None
26+
27+
created_at: Optional[datetime] = None
28+
29+
integrations: Optional[List[object]] = None
30+
31+
jwt_secret: Optional[str] = None
32+
33+
optional_integrations: Optional[List[object]] = None
34+
35+
public_key: Optional[str] = None
36+
37+
settings: Optional[object] = None
38+
39+
40+
from .apikey import Apikey
41+
from .collection import Collection
42+
43+
if PYDANTIC_V2:
44+
App.model_rebuild()
45+
else:
46+
App.update_forward_refs() # type: ignore
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Dict, List, Union, Optional
6+
from datetime import datetime
7+
from typing_extensions import Literal
8+
9+
from ..scores import Scores
10+
from ..._compat import PYDANTIC_V2
11+
from ..._models import BaseModel
12+
13+
__all__ = ["Collection", "Document", "DocumentEvent", "DocumentSection"]
14+
15+
16+
class DocumentEvent(BaseModel):
17+
message: str
18+
19+
type: Literal["error", "warning", "info"]
20+
21+
time: Optional[datetime] = None
22+
23+
24+
class DocumentSection(BaseModel):
25+
document_id: int
26+
27+
text: str
28+
"""Summary of the section"""
29+
30+
id: Optional[int] = None
31+
32+
content: Optional[str] = None
33+
34+
elements: Optional[List[object]] = None
35+
36+
embedding_e5_large: Optional[List[float]] = None
37+
38+
embedding_ts: Optional[str] = None
39+
40+
metadata: Optional[Dict[str, object]] = None
41+
42+
scores: Optional[Scores] = None
43+
44+
45+
class Document(BaseModel):
46+
collection_id: int
47+
48+
data: Union[List[object], object]
49+
"""Structured representation of the document"""
50+
51+
summary: str
52+
"""Summary of the document"""
53+
54+
id: Optional[int] = None
55+
56+
collection: Optional[str] = None
57+
58+
created_at: Optional[datetime] = None
59+
60+
events: Optional[List[DocumentEvent]] = None
61+
62+
ingested_at: Optional[datetime] = None
63+
64+
metadata: Optional[Dict[str, object]] = None
65+
66+
resource_id: Optional[str] = None
67+
"""Along with service, uniquely identifies the source document"""
68+
69+
sections: Optional[List[DocumentSection]] = None
70+
71+
sections_count: Optional[int] = None
72+
73+
source: Optional[Literal["generic", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]] = None
74+
75+
status: Optional[Literal["pending", "processing", "completed", "failed"]] = None
76+
77+
title: Optional[str] = None
78+
79+
type: Optional[
80+
Literal[
81+
"generic",
82+
"markdown",
83+
"chat",
84+
"email",
85+
"transcript",
86+
"legal",
87+
"website",
88+
"image",
89+
"pdf",
90+
"audio",
91+
"spreadsheet",
92+
"archive",
93+
"book",
94+
"video",
95+
"code",
96+
"calendar",
97+
"json",
98+
"presentation",
99+
"unsupported",
100+
"person",
101+
"company",
102+
"crm_contact",
103+
]
104+
] = None
105+
106+
107+
class Collection(BaseModel):
108+
app_id: int
109+
110+
name: str
111+
112+
id: Optional[int] = None
113+
114+
app: Optional["App"] = None
115+
"""Apps Base Schema."""
116+
117+
created_at: Optional[datetime] = None
118+
119+
documents: Optional[List[Document]] = None
120+
121+
documents_count: Optional[int] = None
122+
123+
owner: Optional[str] = None
124+
125+
126+
from .app import App
127+
128+
if PYDANTIC_V2:
129+
Collection.model_rebuild()
130+
Document.model_rebuild()
131+
DocumentEvent.model_rebuild()
132+
DocumentSection.model_rebuild()
133+
else:
134+
Collection.update_forward_refs() # type: ignore
135+
Document.update_forward_refs() # type: ignore
136+
DocumentEvent.update_forward_refs() # type: ignore
137+
DocumentSection.update_forward_refs() # type: ignore

0 commit comments

Comments
 (0)