h2ogpte 1.6.41rc3__py3-none-any.whl → 1.6.41rc5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h2ogpte/__init__.py +1 -1
- h2ogpte/h2ogpte.py +143 -0
- h2ogpte/h2ogpte_async.py +156 -1
- h2ogpte/h2ogpte_sync_base.py +11 -0
- h2ogpte/rest_async/__init__.py +4 -1
- h2ogpte/rest_async/api/__init__.py +1 -0
- h2ogpte/rest_async/api/extractors_api.py +1148 -0
- h2ogpte/rest_async/api_client.py +1 -1
- h2ogpte/rest_async/configuration.py +1 -1
- h2ogpte/rest_async/models/__init__.py +2 -0
- h2ogpte/rest_async/models/extractor.py +98 -0
- h2ogpte/rest_async/models/extractor_create_request.py +93 -0
- h2ogpte/rest_sync/__init__.py +4 -1
- h2ogpte/rest_sync/api/__init__.py +1 -0
- h2ogpte/rest_sync/api/extractors_api.py +1148 -0
- h2ogpte/rest_sync/api_client.py +1 -1
- h2ogpte/rest_sync/configuration.py +1 -1
- h2ogpte/rest_sync/models/__init__.py +2 -0
- h2ogpte/rest_sync/models/extractor.py +98 -0
- h2ogpte/rest_sync/models/extractor_create_request.py +93 -0
- h2ogpte/session.py +1 -0
- h2ogpte/session_async.py +1 -0
- h2ogpte/types.py +17 -1
- {h2ogpte-1.6.41rc3.dist-info → h2ogpte-1.6.41rc5.dist-info}/METADATA +47 -1
- {h2ogpte-1.6.41rc3.dist-info → h2ogpte-1.6.41rc5.dist-info}/RECORD +27 -21
- {h2ogpte-1.6.41rc3.dist-info → h2ogpte-1.6.41rc5.dist-info}/WHEEL +0 -0
- {h2ogpte-1.6.41rc3.dist-info → h2ogpte-1.6.41rc5.dist-info}/top_level.txt +0 -0
h2ogpte/rest_async/api_client.py
CHANGED
|
@@ -90,7 +90,7 @@ class ApiClient:
|
|
|
90
90
|
self.default_headers[header_name] = header_value
|
|
91
91
|
self.cookie = cookie
|
|
92
92
|
# Set default User-Agent.
|
|
93
|
-
self.user_agent = 'OpenAPI-Generator/1.6.41-
|
|
93
|
+
self.user_agent = 'OpenAPI-Generator/1.6.41-dev5/python'
|
|
94
94
|
self.client_side_validation = configuration.client_side_validation
|
|
95
95
|
|
|
96
96
|
async def __aenter__(self):
|
|
@@ -499,7 +499,7 @@ class Configuration:
|
|
|
499
499
|
"OS: {env}\n"\
|
|
500
500
|
"Python Version: {pyversion}\n"\
|
|
501
501
|
"Version of the API: v1.0.0\n"\
|
|
502
|
-
"SDK Package Version: 1.6.41-
|
|
502
|
+
"SDK Package Version: 1.6.41-dev5".\
|
|
503
503
|
format(env=sys.platform, pyversion=sys.version)
|
|
504
504
|
|
|
505
505
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -67,6 +67,8 @@ from h2ogpte.rest_async.models.embedding_model import EmbeddingModel
|
|
|
67
67
|
from h2ogpte.rest_async.models.encode_chunks_for_retrieval_request import EncodeChunksForRetrievalRequest
|
|
68
68
|
from h2ogpte.rest_async.models.endpoint_error import EndpointError
|
|
69
69
|
from h2ogpte.rest_async.models.extraction_request import ExtractionRequest
|
|
70
|
+
from h2ogpte.rest_async.models.extractor import Extractor
|
|
71
|
+
from h2ogpte.rest_async.models.extractor_create_request import ExtractorCreateRequest
|
|
70
72
|
from h2ogpte.rest_async.models.gcs_credentials import GCSCredentials
|
|
71
73
|
from h2ogpte.rest_async.models.global_configuration_item import GlobalConfigurationItem
|
|
72
74
|
from h2ogpte.rest_async.models.group_create_request import GroupCreateRequest
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
h2oGPTe REST API
|
|
5
|
+
|
|
6
|
+
# Overview Users can easily interact with the h2oGPTe API through its REST API, allowing HTTP requests from any programming language. ## Authorization: Getting an API key Sign up/in at Enterprise h2oGPTe and generate one of the following two types of API keys: - **Global API key**: If a Collection is not specified when creating a new API Key, that key is considered to be a global API Key. Use global API Keys to grant full user impersonation and system-wide access to all of your work. Anyone with access to one of your global API Keys can create, delete, or interact with any of your past, current, and future Collections, Documents, Chats, and settings. - **Collection-specific API key**: Use Collection-specific API Keys to grant external access to only Chat with a specified Collection and make related API calls to it. Collection-specific API keys do not allow other API calls, such as creation, deletion, or access to other Collections or Chats. Access Enterprise h2oGPTe through your [H2O Generative AI](https://genai.h2o.ai/appstore) app store account, available with a freemium tier. ## Authorization: Using an API key All h2oGPTe REST API requests must include an API Key in the \"Authorization\" HTTP header, formatted as follows: ``` Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` ```sh curl -X 'POST' \\ 'https://h2ogpte.genai.h2o.ai/api/v1/collections' \\ -H 'accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \\ -d '{ \"name\": \"The name of my Collection\", \"description\": \"The description of my Collection\", \"embedding_model\": \"BAAI/bge-large-en-v1.5\" }' ``` ## Interactive h2oGPTe API testing This page only showcases the h2oGPTe REST API; you can test it directly in the [Swagger UI](https://h2ogpte.genai.h2o.ai/swagger-ui/). Ensure that you are logged into your Enterprise h2oGPTe account.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class Extractor(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Extractor
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
name: StrictStr = Field(description="Human-readable name")
|
|
31
|
+
description: StrictStr = Field(description="What this extractor does")
|
|
32
|
+
llm: Optional[StrictStr] = Field(default=None, description="(Optional) Identifier or version of the language model the extractor uses")
|
|
33
|
+
var_schema: Optional[StrictStr] = Field(default=None, description="(Optional) JSONSchema (or other spec) that the extractor outputs", alias="schema")
|
|
34
|
+
id: StrictStr = Field(description="Unique identifier of the extractor")
|
|
35
|
+
created_at: datetime = Field(description="When the extractor definition was created")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["name", "description", "llm", "schema", "id", "created_at"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of Extractor from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of Extractor from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"name": obj.get("name"),
|
|
90
|
+
"description": obj.get("description"),
|
|
91
|
+
"llm": obj.get("llm"),
|
|
92
|
+
"schema": obj.get("schema"),
|
|
93
|
+
"id": obj.get("id"),
|
|
94
|
+
"created_at": obj.get("created_at")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
h2oGPTe REST API
|
|
5
|
+
|
|
6
|
+
# Overview Users can easily interact with the h2oGPTe API through its REST API, allowing HTTP requests from any programming language. ## Authorization: Getting an API key Sign up/in at Enterprise h2oGPTe and generate one of the following two types of API keys: - **Global API key**: If a Collection is not specified when creating a new API Key, that key is considered to be a global API Key. Use global API Keys to grant full user impersonation and system-wide access to all of your work. Anyone with access to one of your global API Keys can create, delete, or interact with any of your past, current, and future Collections, Documents, Chats, and settings. - **Collection-specific API key**: Use Collection-specific API Keys to grant external access to only Chat with a specified Collection and make related API calls to it. Collection-specific API keys do not allow other API calls, such as creation, deletion, or access to other Collections or Chats. Access Enterprise h2oGPTe through your [H2O Generative AI](https://genai.h2o.ai/appstore) app store account, available with a freemium tier. ## Authorization: Using an API key All h2oGPTe REST API requests must include an API Key in the \"Authorization\" HTTP header, formatted as follows: ``` Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` ```sh curl -X 'POST' \\ 'https://h2ogpte.genai.h2o.ai/api/v1/collections' \\ -H 'accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \\ -d '{ \"name\": \"The name of my Collection\", \"description\": \"The description of my Collection\", \"embedding_model\": \"BAAI/bge-large-en-v1.5\" }' ``` ## Interactive h2oGPTe API testing This page only showcases the h2oGPTe REST API; you can test it directly in the [Swagger UI](https://h2ogpte.genai.h2o.ai/swagger-ui/). Ensure that you are logged into your Enterprise h2oGPTe account.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ExtractorCreateRequest(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
ExtractorCreateRequest
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
name: StrictStr = Field(description="Human-readable name")
|
|
30
|
+
description: StrictStr = Field(description="What this extractor does")
|
|
31
|
+
llm: StrictStr = Field(description="Identifier or version of the language model the extractor uses")
|
|
32
|
+
var_schema: StrictStr = Field(description="JSONSchema (or other spec) that the extractor outputs", alias="schema")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["name", "description", "llm", "schema"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ExtractorCreateRequest from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of ExtractorCreateRequest from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"name": obj.get("name"),
|
|
87
|
+
"description": obj.get("description"),
|
|
88
|
+
"llm": obj.get("llm"),
|
|
89
|
+
"schema": obj.get("schema")
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
h2ogpte/rest_sync/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
""" # noqa: E501
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
__version__ = "1.6.41-
|
|
17
|
+
__version__ = "1.6.41-dev5"
|
|
18
18
|
|
|
19
19
|
# import apis into sdk package
|
|
20
20
|
from h2ogpte.rest_sync.api.api_keys_api import APIKeysApi
|
|
@@ -24,6 +24,7 @@ from h2ogpte.rest_sync.api.collections_api import CollectionsApi
|
|
|
24
24
|
from h2ogpte.rest_sync.api.configurations_api import ConfigurationsApi
|
|
25
25
|
from h2ogpte.rest_sync.api.document_ingestion_api import DocumentIngestionApi
|
|
26
26
|
from h2ogpte.rest_sync.api.documents_api import DocumentsApi
|
|
27
|
+
from h2ogpte.rest_sync.api.extractors_api import ExtractorsApi
|
|
27
28
|
from h2ogpte.rest_sync.api.jobs_api import JobsApi
|
|
28
29
|
from h2ogpte.rest_sync.api.models_api import ModelsApi
|
|
29
30
|
from h2ogpte.rest_sync.api.permissions_api import PermissionsApi
|
|
@@ -97,6 +98,8 @@ from h2ogpte.rest_sync.models.embedding_model import EmbeddingModel
|
|
|
97
98
|
from h2ogpte.rest_sync.models.encode_chunks_for_retrieval_request import EncodeChunksForRetrievalRequest
|
|
98
99
|
from h2ogpte.rest_sync.models.endpoint_error import EndpointError
|
|
99
100
|
from h2ogpte.rest_sync.models.extraction_request import ExtractionRequest
|
|
101
|
+
from h2ogpte.rest_sync.models.extractor import Extractor
|
|
102
|
+
from h2ogpte.rest_sync.models.extractor_create_request import ExtractorCreateRequest
|
|
100
103
|
from h2ogpte.rest_sync.models.gcs_credentials import GCSCredentials
|
|
101
104
|
from h2ogpte.rest_sync.models.global_configuration_item import GlobalConfigurationItem
|
|
102
105
|
from h2ogpte.rest_sync.models.group_create_request import GroupCreateRequest
|
|
@@ -8,6 +8,7 @@ from h2ogpte.rest_sync.api.collections_api import CollectionsApi
|
|
|
8
8
|
from h2ogpte.rest_sync.api.configurations_api import ConfigurationsApi
|
|
9
9
|
from h2ogpte.rest_sync.api.document_ingestion_api import DocumentIngestionApi
|
|
10
10
|
from h2ogpte.rest_sync.api.documents_api import DocumentsApi
|
|
11
|
+
from h2ogpte.rest_sync.api.extractors_api import ExtractorsApi
|
|
11
12
|
from h2ogpte.rest_sync.api.jobs_api import JobsApi
|
|
12
13
|
from h2ogpte.rest_sync.api.models_api import ModelsApi
|
|
13
14
|
from h2ogpte.rest_sync.api.permissions_api import PermissionsApi
|