h2ogpte 1.6.53rc2__py3-none-any.whl → 1.6.54rc1__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 +1 -55
- h2ogpte/h2ogpte_async.py +1 -55
- h2ogpte/rest_async/__init__.py +1 -3
- h2ogpte/rest_async/api/agents_api.py +25 -25
- h2ogpte/rest_async/api_client.py +1 -1
- h2ogpte/rest_async/configuration.py +1 -1
- h2ogpte/rest_async/models/__init__.py +0 -2
- h2ogpte/rest_async/models/chat_completion_request.py +2 -6
- h2ogpte/rest_async/models/chat_settings.py +2 -6
- h2ogpte/rest_async/models/ingest_from_confluence_body.py +2 -4
- h2ogpte/rest_sync/__init__.py +1 -3
- h2ogpte/rest_sync/api/agents_api.py +25 -25
- h2ogpte/rest_sync/api_client.py +1 -1
- h2ogpte/rest_sync/configuration.py +1 -1
- h2ogpte/rest_sync/models/__init__.py +0 -2
- h2ogpte/rest_sync/models/chat_completion_request.py +2 -6
- h2ogpte/rest_sync/models/chat_settings.py +2 -6
- h2ogpte/rest_sync/models/ingest_from_confluence_body.py +2 -4
- h2ogpte/session.py +6 -10
- h2ogpte/session_async.py +3 -8
- h2ogpte/types.py +1 -16
- {h2ogpte-1.6.53rc2.dist-info → h2ogpte-1.6.54rc1.dist-info}/METADATA +1 -1
- {h2ogpte-1.6.53rc2.dist-info → h2ogpte-1.6.54rc1.dist-info}/RECORD +27 -31
- h2ogpte/rest_async/models/chat_settings_tags.py +0 -140
- h2ogpte/rest_async/models/tag_filter.py +0 -89
- h2ogpte/rest_sync/models/chat_settings_tags.py +0 -140
- h2ogpte/rest_sync/models/tag_filter.py +0 -89
- {h2ogpte-1.6.53rc2.dist-info → h2ogpte-1.6.54rc1.dist-info}/WHEEL +0 -0
- {h2ogpte-1.6.53rc2.dist-info → h2ogpte-1.6.54rc1.dist-info}/entry_points.txt +0 -0
- {h2ogpte-1.6.53rc2.dist-info → h2ogpte-1.6.54rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,140 +0,0 @@
|
|
|
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 json
|
|
17
|
-
import pprint
|
|
18
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
-
from typing import Any, List, Optional
|
|
20
|
-
from h2ogpte.rest_async.models.tag_filter import TagFilter
|
|
21
|
-
from pydantic import StrictStr, Field
|
|
22
|
-
from typing import Union, List, Set, Optional, Dict
|
|
23
|
-
from typing_extensions import Literal, Self
|
|
24
|
-
|
|
25
|
-
CHATSETTINGSTAGS_ONE_OF_SCHEMAS = ["List[str]", "TagFilter"]
|
|
26
|
-
|
|
27
|
-
class ChatSettingsTags(BaseModel):
|
|
28
|
-
"""
|
|
29
|
-
Filter documents by tags for RAG context. Supports two formats: - Array format (backward compatible): [\"red\", \"blue\"] includes documents with 'red' OR 'blue' tags - Object format (with exclusions): {\"include\": [\"color\"], \"exclude\": [\"red\", \"blue\"]}
|
|
30
|
-
"""
|
|
31
|
-
# data type: List[str]
|
|
32
|
-
oneof_schema_1_validator: Optional[List[StrictStr]] = None
|
|
33
|
-
# data type: TagFilter
|
|
34
|
-
oneof_schema_2_validator: Optional[TagFilter] = None
|
|
35
|
-
actual_instance: Optional[Union[List[str], TagFilter]] = None
|
|
36
|
-
one_of_schemas: Set[str] = { "List[str]", "TagFilter" }
|
|
37
|
-
|
|
38
|
-
model_config = ConfigDict(
|
|
39
|
-
validate_assignment=True,
|
|
40
|
-
protected_namespaces=(),
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
45
|
-
if args:
|
|
46
|
-
if len(args) > 1:
|
|
47
|
-
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
48
|
-
if kwargs:
|
|
49
|
-
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
50
|
-
super().__init__(actual_instance=args[0])
|
|
51
|
-
else:
|
|
52
|
-
super().__init__(**kwargs)
|
|
53
|
-
|
|
54
|
-
@field_validator('actual_instance')
|
|
55
|
-
def actual_instance_must_validate_oneof(cls, v):
|
|
56
|
-
instance = ChatSettingsTags.model_construct()
|
|
57
|
-
error_messages = []
|
|
58
|
-
match = 0
|
|
59
|
-
# validate data type: List[str]
|
|
60
|
-
try:
|
|
61
|
-
instance.oneof_schema_1_validator = v
|
|
62
|
-
match += 1
|
|
63
|
-
except (ValidationError, ValueError) as e:
|
|
64
|
-
error_messages.append(str(e))
|
|
65
|
-
# validate data type: TagFilter
|
|
66
|
-
if not isinstance(v, TagFilter):
|
|
67
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `TagFilter`")
|
|
68
|
-
else:
|
|
69
|
-
match += 1
|
|
70
|
-
if match > 1:
|
|
71
|
-
# more than 1 match
|
|
72
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
73
|
-
elif match == 0:
|
|
74
|
-
# no match
|
|
75
|
-
raise ValueError("No match found when setting `actual_instance` in ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
76
|
-
else:
|
|
77
|
-
return v
|
|
78
|
-
|
|
79
|
-
@classmethod
|
|
80
|
-
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
81
|
-
return cls.from_json(json.dumps(obj))
|
|
82
|
-
|
|
83
|
-
@classmethod
|
|
84
|
-
def from_json(cls, json_str: str) -> Self:
|
|
85
|
-
"""Returns the object represented by the json string"""
|
|
86
|
-
instance = cls.model_construct()
|
|
87
|
-
error_messages = []
|
|
88
|
-
match = 0
|
|
89
|
-
|
|
90
|
-
# deserialize data into List[str]
|
|
91
|
-
try:
|
|
92
|
-
# validation
|
|
93
|
-
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
94
|
-
# assign value to actual_instance
|
|
95
|
-
instance.actual_instance = instance.oneof_schema_1_validator
|
|
96
|
-
match += 1
|
|
97
|
-
except (ValidationError, ValueError) as e:
|
|
98
|
-
error_messages.append(str(e))
|
|
99
|
-
# deserialize data into TagFilter
|
|
100
|
-
try:
|
|
101
|
-
instance.actual_instance = TagFilter.from_json(json_str)
|
|
102
|
-
match += 1
|
|
103
|
-
except (ValidationError, ValueError) as e:
|
|
104
|
-
error_messages.append(str(e))
|
|
105
|
-
|
|
106
|
-
if match > 1:
|
|
107
|
-
# more than 1 match
|
|
108
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
109
|
-
elif match == 0:
|
|
110
|
-
# no match
|
|
111
|
-
raise ValueError("No match found when deserializing the JSON string into ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
112
|
-
else:
|
|
113
|
-
return instance
|
|
114
|
-
|
|
115
|
-
def to_json(self) -> str:
|
|
116
|
-
"""Returns the JSON representation of the actual instance"""
|
|
117
|
-
if self.actual_instance is None:
|
|
118
|
-
return "null"
|
|
119
|
-
|
|
120
|
-
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
121
|
-
return self.actual_instance.to_json()
|
|
122
|
-
else:
|
|
123
|
-
return json.dumps(self.actual_instance)
|
|
124
|
-
|
|
125
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], List[str], TagFilter]]:
|
|
126
|
-
"""Returns the dict representation of the actual instance"""
|
|
127
|
-
if self.actual_instance is None:
|
|
128
|
-
return None
|
|
129
|
-
|
|
130
|
-
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
131
|
-
return self.actual_instance.to_dict()
|
|
132
|
-
else:
|
|
133
|
-
# primitive type
|
|
134
|
-
return self.actual_instance
|
|
135
|
-
|
|
136
|
-
def to_str(self) -> str:
|
|
137
|
-
"""Returns the string representation of the actual instance"""
|
|
138
|
-
return pprint.pformat(self.model_dump())
|
|
139
|
-
|
|
140
|
-
|
|
@@ -1,89 +0,0 @@
|
|
|
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, Optional
|
|
22
|
-
from typing import Optional, Set
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
class TagFilter(BaseModel):
|
|
26
|
-
"""
|
|
27
|
-
Filter for document tags supporting inclusion and exclusion. Note: The exclude list takes priority over the include list. If a document has a tag that appears in both lists, the document will be excluded. Examples: - Include only documents with 'red' OR 'blue' tags: {\"include\": [\"red\", \"blue\"]} - Exclude documents with 'red' OR 'blue' tags: {\"exclude\": [\"red\", \"blue\"]} - Include documents with 'color' tag BUT exclude 'red' and 'blue': {\"include\": [\"color\"], \"exclude\": [\"red\", \"blue\"]}
|
|
28
|
-
""" # noqa: E501
|
|
29
|
-
include: Optional[List[StrictStr]] = Field(default=None, description="Include documents with ANY of these tags (OR operation).")
|
|
30
|
-
exclude: Optional[List[StrictStr]] = Field(default=None, description="Exclude documents with ANY of these tags (OR operation). Takes priority over include.")
|
|
31
|
-
__properties: ClassVar[List[str]] = ["include", "exclude"]
|
|
32
|
-
|
|
33
|
-
model_config = ConfigDict(
|
|
34
|
-
populate_by_name=True,
|
|
35
|
-
validate_assignment=True,
|
|
36
|
-
protected_namespaces=(),
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def to_str(self) -> str:
|
|
41
|
-
"""Returns the string representation of the model using alias"""
|
|
42
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
-
|
|
44
|
-
def to_json(self) -> str:
|
|
45
|
-
"""Returns the JSON representation of the model using alias"""
|
|
46
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
-
return json.dumps(self.to_dict())
|
|
48
|
-
|
|
49
|
-
@classmethod
|
|
50
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
-
"""Create an instance of TagFilter from a JSON string"""
|
|
52
|
-
return cls.from_dict(json.loads(json_str))
|
|
53
|
-
|
|
54
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
-
"""Return the dictionary representation of the model using alias.
|
|
56
|
-
|
|
57
|
-
This has the following differences from calling pydantic's
|
|
58
|
-
`self.model_dump(by_alias=True)`:
|
|
59
|
-
|
|
60
|
-
* `None` is only added to the output dict for nullable fields that
|
|
61
|
-
were set at model initialization. Other fields with value `None`
|
|
62
|
-
are ignored.
|
|
63
|
-
"""
|
|
64
|
-
excluded_fields: Set[str] = set([
|
|
65
|
-
])
|
|
66
|
-
|
|
67
|
-
_dict = self.model_dump(
|
|
68
|
-
by_alias=True,
|
|
69
|
-
exclude=excluded_fields,
|
|
70
|
-
exclude_none=True,
|
|
71
|
-
)
|
|
72
|
-
return _dict
|
|
73
|
-
|
|
74
|
-
@classmethod
|
|
75
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
-
"""Create an instance of TagFilter from a dict"""
|
|
77
|
-
if obj is None:
|
|
78
|
-
return None
|
|
79
|
-
|
|
80
|
-
if not isinstance(obj, dict):
|
|
81
|
-
return cls.model_validate(obj)
|
|
82
|
-
|
|
83
|
-
_obj = cls.model_validate({
|
|
84
|
-
"include": obj.get("include"),
|
|
85
|
-
"exclude": obj.get("exclude")
|
|
86
|
-
})
|
|
87
|
-
return _obj
|
|
88
|
-
|
|
89
|
-
|
|
@@ -1,140 +0,0 @@
|
|
|
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 json
|
|
17
|
-
import pprint
|
|
18
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
-
from typing import Any, List, Optional
|
|
20
|
-
from h2ogpte.rest_sync.models.tag_filter import TagFilter
|
|
21
|
-
from pydantic import StrictStr, Field
|
|
22
|
-
from typing import Union, List, Set, Optional, Dict
|
|
23
|
-
from typing_extensions import Literal, Self
|
|
24
|
-
|
|
25
|
-
CHATSETTINGSTAGS_ONE_OF_SCHEMAS = ["List[str]", "TagFilter"]
|
|
26
|
-
|
|
27
|
-
class ChatSettingsTags(BaseModel):
|
|
28
|
-
"""
|
|
29
|
-
Filter documents by tags for RAG context. Supports two formats: - Array format (backward compatible): [\"red\", \"blue\"] includes documents with 'red' OR 'blue' tags - Object format (with exclusions): {\"include\": [\"color\"], \"exclude\": [\"red\", \"blue\"]}
|
|
30
|
-
"""
|
|
31
|
-
# data type: List[str]
|
|
32
|
-
oneof_schema_1_validator: Optional[List[StrictStr]] = None
|
|
33
|
-
# data type: TagFilter
|
|
34
|
-
oneof_schema_2_validator: Optional[TagFilter] = None
|
|
35
|
-
actual_instance: Optional[Union[List[str], TagFilter]] = None
|
|
36
|
-
one_of_schemas: Set[str] = { "List[str]", "TagFilter" }
|
|
37
|
-
|
|
38
|
-
model_config = ConfigDict(
|
|
39
|
-
validate_assignment=True,
|
|
40
|
-
protected_namespaces=(),
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def __init__(self, *args, **kwargs) -> None:
|
|
45
|
-
if args:
|
|
46
|
-
if len(args) > 1:
|
|
47
|
-
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
48
|
-
if kwargs:
|
|
49
|
-
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
50
|
-
super().__init__(actual_instance=args[0])
|
|
51
|
-
else:
|
|
52
|
-
super().__init__(**kwargs)
|
|
53
|
-
|
|
54
|
-
@field_validator('actual_instance')
|
|
55
|
-
def actual_instance_must_validate_oneof(cls, v):
|
|
56
|
-
instance = ChatSettingsTags.model_construct()
|
|
57
|
-
error_messages = []
|
|
58
|
-
match = 0
|
|
59
|
-
# validate data type: List[str]
|
|
60
|
-
try:
|
|
61
|
-
instance.oneof_schema_1_validator = v
|
|
62
|
-
match += 1
|
|
63
|
-
except (ValidationError, ValueError) as e:
|
|
64
|
-
error_messages.append(str(e))
|
|
65
|
-
# validate data type: TagFilter
|
|
66
|
-
if not isinstance(v, TagFilter):
|
|
67
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `TagFilter`")
|
|
68
|
-
else:
|
|
69
|
-
match += 1
|
|
70
|
-
if match > 1:
|
|
71
|
-
# more than 1 match
|
|
72
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
73
|
-
elif match == 0:
|
|
74
|
-
# no match
|
|
75
|
-
raise ValueError("No match found when setting `actual_instance` in ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
76
|
-
else:
|
|
77
|
-
return v
|
|
78
|
-
|
|
79
|
-
@classmethod
|
|
80
|
-
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
81
|
-
return cls.from_json(json.dumps(obj))
|
|
82
|
-
|
|
83
|
-
@classmethod
|
|
84
|
-
def from_json(cls, json_str: str) -> Self:
|
|
85
|
-
"""Returns the object represented by the json string"""
|
|
86
|
-
instance = cls.model_construct()
|
|
87
|
-
error_messages = []
|
|
88
|
-
match = 0
|
|
89
|
-
|
|
90
|
-
# deserialize data into List[str]
|
|
91
|
-
try:
|
|
92
|
-
# validation
|
|
93
|
-
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
94
|
-
# assign value to actual_instance
|
|
95
|
-
instance.actual_instance = instance.oneof_schema_1_validator
|
|
96
|
-
match += 1
|
|
97
|
-
except (ValidationError, ValueError) as e:
|
|
98
|
-
error_messages.append(str(e))
|
|
99
|
-
# deserialize data into TagFilter
|
|
100
|
-
try:
|
|
101
|
-
instance.actual_instance = TagFilter.from_json(json_str)
|
|
102
|
-
match += 1
|
|
103
|
-
except (ValidationError, ValueError) as e:
|
|
104
|
-
error_messages.append(str(e))
|
|
105
|
-
|
|
106
|
-
if match > 1:
|
|
107
|
-
# more than 1 match
|
|
108
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
109
|
-
elif match == 0:
|
|
110
|
-
# no match
|
|
111
|
-
raise ValueError("No match found when deserializing the JSON string into ChatSettingsTags with oneOf schemas: List[str], TagFilter. Details: " + ", ".join(error_messages))
|
|
112
|
-
else:
|
|
113
|
-
return instance
|
|
114
|
-
|
|
115
|
-
def to_json(self) -> str:
|
|
116
|
-
"""Returns the JSON representation of the actual instance"""
|
|
117
|
-
if self.actual_instance is None:
|
|
118
|
-
return "null"
|
|
119
|
-
|
|
120
|
-
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
121
|
-
return self.actual_instance.to_json()
|
|
122
|
-
else:
|
|
123
|
-
return json.dumps(self.actual_instance)
|
|
124
|
-
|
|
125
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], List[str], TagFilter]]:
|
|
126
|
-
"""Returns the dict representation of the actual instance"""
|
|
127
|
-
if self.actual_instance is None:
|
|
128
|
-
return None
|
|
129
|
-
|
|
130
|
-
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
131
|
-
return self.actual_instance.to_dict()
|
|
132
|
-
else:
|
|
133
|
-
# primitive type
|
|
134
|
-
return self.actual_instance
|
|
135
|
-
|
|
136
|
-
def to_str(self) -> str:
|
|
137
|
-
"""Returns the string representation of the actual instance"""
|
|
138
|
-
return pprint.pformat(self.model_dump())
|
|
139
|
-
|
|
140
|
-
|
|
@@ -1,89 +0,0 @@
|
|
|
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, Optional
|
|
22
|
-
from typing import Optional, Set
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
class TagFilter(BaseModel):
|
|
26
|
-
"""
|
|
27
|
-
Filter for document tags supporting inclusion and exclusion. Note: The exclude list takes priority over the include list. If a document has a tag that appears in both lists, the document will be excluded. Examples: - Include only documents with 'red' OR 'blue' tags: {\"include\": [\"red\", \"blue\"]} - Exclude documents with 'red' OR 'blue' tags: {\"exclude\": [\"red\", \"blue\"]} - Include documents with 'color' tag BUT exclude 'red' and 'blue': {\"include\": [\"color\"], \"exclude\": [\"red\", \"blue\"]}
|
|
28
|
-
""" # noqa: E501
|
|
29
|
-
include: Optional[List[StrictStr]] = Field(default=None, description="Include documents with ANY of these tags (OR operation).")
|
|
30
|
-
exclude: Optional[List[StrictStr]] = Field(default=None, description="Exclude documents with ANY of these tags (OR operation). Takes priority over include.")
|
|
31
|
-
__properties: ClassVar[List[str]] = ["include", "exclude"]
|
|
32
|
-
|
|
33
|
-
model_config = ConfigDict(
|
|
34
|
-
populate_by_name=True,
|
|
35
|
-
validate_assignment=True,
|
|
36
|
-
protected_namespaces=(),
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def to_str(self) -> str:
|
|
41
|
-
"""Returns the string representation of the model using alias"""
|
|
42
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
-
|
|
44
|
-
def to_json(self) -> str:
|
|
45
|
-
"""Returns the JSON representation of the model using alias"""
|
|
46
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
-
return json.dumps(self.to_dict())
|
|
48
|
-
|
|
49
|
-
@classmethod
|
|
50
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
-
"""Create an instance of TagFilter from a JSON string"""
|
|
52
|
-
return cls.from_dict(json.loads(json_str))
|
|
53
|
-
|
|
54
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
-
"""Return the dictionary representation of the model using alias.
|
|
56
|
-
|
|
57
|
-
This has the following differences from calling pydantic's
|
|
58
|
-
`self.model_dump(by_alias=True)`:
|
|
59
|
-
|
|
60
|
-
* `None` is only added to the output dict for nullable fields that
|
|
61
|
-
were set at model initialization. Other fields with value `None`
|
|
62
|
-
are ignored.
|
|
63
|
-
"""
|
|
64
|
-
excluded_fields: Set[str] = set([
|
|
65
|
-
])
|
|
66
|
-
|
|
67
|
-
_dict = self.model_dump(
|
|
68
|
-
by_alias=True,
|
|
69
|
-
exclude=excluded_fields,
|
|
70
|
-
exclude_none=True,
|
|
71
|
-
)
|
|
72
|
-
return _dict
|
|
73
|
-
|
|
74
|
-
@classmethod
|
|
75
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
-
"""Create an instance of TagFilter from a dict"""
|
|
77
|
-
if obj is None:
|
|
78
|
-
return None
|
|
79
|
-
|
|
80
|
-
if not isinstance(obj, dict):
|
|
81
|
-
return cls.model_validate(obj)
|
|
82
|
-
|
|
83
|
-
_obj = cls.model_validate({
|
|
84
|
-
"include": obj.get("include"),
|
|
85
|
-
"exclude": obj.get("exclude")
|
|
86
|
-
})
|
|
87
|
-
return _obj
|
|
88
|
-
|
|
89
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|