h2ogpte 1.6.55rc1__py3-none-any.whl → 1.7.0rc2__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 +213 -20
- h2ogpte/h2ogpte_async.py +213 -20
- h2ogpte/rest_async/__init__.py +3 -2
- h2ogpte/rest_async/api/agents_api.py +25 -25
- h2ogpte/rest_async/api/chat_api.py +1077 -21
- h2ogpte/rest_async/api/collections_api.py +281 -0
- h2ogpte/rest_async/api/models_api.py +35 -67
- h2ogpte/rest_async/api_client.py +1 -1
- h2ogpte/rest_async/configuration.py +1 -1
- h2ogpte/rest_async/models/__init__.py +2 -1
- h2ogpte/rest_async/models/chat_completion_request.py +6 -2
- h2ogpte/rest_async/models/chat_settings.py +6 -2
- h2ogpte/rest_async/models/chat_settings_tags.py +140 -0
- h2ogpte/rest_async/models/extractor.py +26 -2
- h2ogpte/rest_async/models/extractor_create_request.py +29 -5
- h2ogpte/rest_async/models/ingest_from_confluence_body.py +4 -2
- h2ogpte/rest_async/models/{create_topic_model_job_request.py → tag_filter.py} +11 -9
- h2ogpte/rest_sync/__init__.py +3 -2
- h2ogpte/rest_sync/api/agents_api.py +25 -25
- h2ogpte/rest_sync/api/chat_api.py +1077 -21
- h2ogpte/rest_sync/api/collections_api.py +281 -0
- h2ogpte/rest_sync/api/models_api.py +35 -67
- h2ogpte/rest_sync/api_client.py +1 -1
- h2ogpte/rest_sync/configuration.py +1 -1
- h2ogpte/rest_sync/models/__init__.py +2 -1
- h2ogpte/rest_sync/models/chat_completion_request.py +6 -2
- h2ogpte/rest_sync/models/chat_settings.py +6 -2
- h2ogpte/rest_sync/models/chat_settings_tags.py +140 -0
- h2ogpte/rest_sync/models/extractor.py +26 -2
- h2ogpte/rest_sync/models/extractor_create_request.py +29 -5
- h2ogpte/rest_sync/models/ingest_from_confluence_body.py +4 -2
- h2ogpte/rest_sync/models/{create_topic_model_job_request.py → tag_filter.py} +11 -9
- h2ogpte/session.py +10 -5
- h2ogpte/session_async.py +10 -2
- h2ogpte/types.py +28 -1
- {h2ogpte-1.6.55rc1.dist-info → h2ogpte-1.7.0rc2.dist-info}/METADATA +1 -1
- {h2ogpte-1.6.55rc1.dist-info → h2ogpte-1.7.0rc2.dist-info}/RECORD +41 -39
- {h2ogpte-1.6.55rc1.dist-info → h2ogpte-1.7.0rc2.dist-info}/WHEEL +0 -0
- {h2ogpte-1.6.55rc1.dist-info → h2ogpte-1.7.0rc2.dist-info}/entry_points.txt +0 -0
- {h2ogpte-1.6.55rc1.dist-info → h2ogpte-1.7.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from h2ogpte.rest_sync.models.chat_settings_tags import ChatSettingsTags
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -37,7 +38,7 @@ class ChatCompletionRequest(BaseModel):
|
|
|
37
38
|
self_reflection_config: Optional[Dict[str, Any]] = Field(default=None, description="A map with self reflection settings: * `llm_reflection` **(type=string, example=gpt-4-0613)** * `prompt_reflection` **(type=string, example=\\\"\\\"\\\"Prompt:\\\\\\\\n%s\\\\\\\\n\\\"\\\"\\\"\\\\\\\\n\\\\\\\\n\\\"\\\"\\\")** * `system_prompt_reflection` **(type=string)** * `llm_args_reflection` **(type=string, example={})** ")
|
|
38
39
|
rag_config: Optional[Dict[str, Any]] = Field(default=None, description="A map with arguments to control RAG (retrieval-augmented-generation) types.: * `rag_type` **(type=enum[auto, llm_only, rag, hyde1, hyde2, rag+, all_data])** RAG type options: * `auto` - Automatically select the best rag_type. * `llm_only` LLM Only - Answer the query without any supporting document contexts. Requires 1 LLM call. * `rag` RAG (Retrieval Augmented Generation) - Use supporting document contexts to answer the query. Requires 1 LLM call. * `hyde1` LLM Only + RAG composite - HyDE RAG (Hypothetical Document Embedding). Use 'LLM Only' response to find relevant contexts from a collection for generating a response. Requires 2 LLM calls. * `hyde2` HyDE + RAG composite - Use the 'HyDE RAG' response to find relevant contexts from a collection for generating a response. Requires 3 LLM calls. * `rag+` Summary RAG - Like RAG, but uses more context and recursive summarization to overcome LLM context limits. Keeps all retrieved chunks, puts them in order, adds neighboring chunks, then uses the summary API to get the answer. Can require several LLM calls. * `all_data` All Data RAG - Like Summary RAG, but includes all document chunks. Uses recursive summarization to overcome LLM context limits. Can require several LLM calls. * `hyde_no_rag_llm_prompt_extension` **(type=string, example=\\\\\\\\nKeep the answer brief, and list the 5 most relevant key words at the end.)** - Add this prompt to every user's prompt, when generating answers to be used for subsequent retrieval during HyDE. Only used when rag_type is `hyde1` or `hyde2`. * `num_neighbor_chunks_to_include` **(type=integer, default=1)** - A number of neighboring chunks to include for every retrieved relevant chunk. It helps to keep surrounding context together. Only enabled for rag_type `rag+`. * `meta_data_to_include` **(type=map)** - A map with flags that indicate whether each piece of document metadata is to be included as part of the context for a chat with a collection. * `name` **(type: boolean, default=True)** * `text` **(type: boolean, default=True)** * `page` **(type: boolean, default=True)** * `captions` **(type: boolean, default=True)** * `uri` **(type: boolean, default=False)** * `connector` **(type: boolean, default=False)** * `original_mtime` **(type: boolean, default=False)** * `age` **(type: boolean, default=False)** * `score` **(type: boolean, default=False)** * `rag_max_chunks` **(type=integer, default=-1)** - Maximum number of document chunks to retrieve for RAG. Actual number depends on rag_type and admin configuration. Set to >0 values to enable. Can be combined with rag_min_chunk_score. * `rag_min_chunk_score` **(type=double, default=0.0)** - Minimum score of document chunks to retrieve for RAG. Set to >0 values to enable. Can be combined with rag_max_chunks. ")
|
|
39
40
|
include_chat_history: Optional[StrictStr] = Field(default=None, description="Whether to include chat history. Includes previous questions and answers for the current chat session for each new chat request. Disable if require deterministic answers for a given question.")
|
|
40
|
-
tags: Optional[
|
|
41
|
+
tags: Optional[ChatSettingsTags] = None
|
|
41
42
|
__properties: ClassVar[List[str]] = ["message", "system_prompt", "pre_prompt_query", "prompt_query", "image_batch_final_prompt", "image_batch_image_prompt", "llm", "llm_args", "self_reflection_config", "rag_config", "include_chat_history", "tags"]
|
|
42
43
|
|
|
43
44
|
@field_validator('include_chat_history')
|
|
@@ -89,6 +90,9 @@ class ChatCompletionRequest(BaseModel):
|
|
|
89
90
|
exclude=excluded_fields,
|
|
90
91
|
exclude_none=True,
|
|
91
92
|
)
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of tags
|
|
94
|
+
if self.tags:
|
|
95
|
+
_dict['tags'] = self.tags.to_dict()
|
|
92
96
|
return _dict
|
|
93
97
|
|
|
94
98
|
@classmethod
|
|
@@ -112,7 +116,7 @@ class ChatCompletionRequest(BaseModel):
|
|
|
112
116
|
"self_reflection_config": obj.get("self_reflection_config"),
|
|
113
117
|
"rag_config": obj.get("rag_config"),
|
|
114
118
|
"include_chat_history": obj.get("include_chat_history"),
|
|
115
|
-
"tags": obj.get("tags"),
|
|
119
|
+
"tags": ChatSettingsTags.from_dict(obj["tags"]) if obj.get("tags") is not None else None,
|
|
116
120
|
})
|
|
117
121
|
return _obj
|
|
118
122
|
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from h2ogpte.rest_sync.models.chat_settings_tags import ChatSettingsTags
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -31,7 +32,7 @@ class ChatSettings(BaseModel):
|
|
|
31
32
|
self_reflection_config: Optional[Dict[str, Any]] = Field(default=None, description="A map with self reflection settings: * `llm_reflection` **(type=string, example=gpt-4-0613)** * `prompt_reflection` **(type=string, example=\\\"\\\"\\\"Prompt:\\\\\\\\n%s\\\\\\\\n\\\"\\\"\\\"\\\\\\\\n\\\\\\\\n\\\"\\\"\\\")** * `system_prompt_reflection` **(type=string)** * `llm_args_reflection` **(type=string, example={})** ")
|
|
32
33
|
rag_config: Optional[Dict[str, Any]] = Field(default=None, description="A map with arguments to control RAG (retrieval-augmented-generation) types.: * `rag_type` **(type=enum[auto, llm_only, rag, hyde1, hyde2, rag+, all_data])** RAG type options: * `auto` - Automatically select the best rag_type. * `llm_only` LLM Only - Answer the query without any supporting document contexts. Requires 1 LLM call. * `rag` RAG (Retrieval Augmented Generation) - Use supporting document contexts to answer the query. Requires 1 LLM call. * `hyde1` LLM Only + RAG composite - HyDE RAG (Hypothetical Document Embedding). Use 'LLM Only' response to find relevant contexts from a collection for generating a response. Requires 2 LLM calls. * `hyde2` HyDE + RAG composite - Use the 'HyDE RAG' response to find relevant contexts from a collection for generating a response. Requires 3 LLM calls. * `rag+` Summary RAG - Like RAG, but uses more context and recursive summarization to overcome LLM context limits. Keeps all retrieved chunks, puts them in order, adds neighboring chunks, then uses the summary API to get the answer. Can require several LLM calls. * `all_data` All Data RAG - Like Summary RAG, but includes all document chunks. Uses recursive summarization to overcome LLM context limits. Can require several LLM calls. * `hyde_no_rag_llm_prompt_extension` **(type=string, example=\\\\\\\\nKeep the answer brief, and list the 5 most relevant key words at the end.)** - Add this prompt to every user's prompt, when generating answers to be used for subsequent retrieval during HyDE. Only used when rag_type is `hyde1` or `hyde2`. * `num_neighbor_chunks_to_include` **(type=integer, default=1)** - A number of neighboring chunks to include for every retrieved relevant chunk. It helps to keep surrounding context together. Only enabled for rag_type `rag+`. * `meta_data_to_include` **(type=map)** - A map with flags that indicate whether each piece of document metadata is to be included as part of the context for a chat with a collection. * `name` **(type: boolean, default=True)** * `text` **(type: boolean, default=True)** * `page` **(type: boolean, default=True)** * `captions` **(type: boolean, default=True)** * `uri` **(type: boolean, default=False)** * `connector` **(type: boolean, default=False)** * `original_mtime` **(type: boolean, default=False)** * `age` **(type: boolean, default=False)** * `score` **(type: boolean, default=False)** * `rag_max_chunks` **(type=integer, default=-1)** - Maximum number of document chunks to retrieve for RAG. Actual number depends on rag_type and admin configuration. Set to >0 values to enable. Can be combined with rag_min_chunk_score. * `rag_min_chunk_score` **(type=double, default=0.0)** - Minimum score of document chunks to retrieve for RAG. Set to >0 values to enable. Can be combined with rag_max_chunks. ")
|
|
33
34
|
include_chat_history: Optional[StrictStr] = Field(default=None, description="Whether to include chat history. Includes previous questions and answers for the current chat session for each new chat request. Disable if require deterministic answers for a given question.")
|
|
34
|
-
tags: Optional[
|
|
35
|
+
tags: Optional[ChatSettingsTags] = None
|
|
35
36
|
__properties: ClassVar[List[str]] = ["llm", "llm_args", "self_reflection_config", "rag_config", "include_chat_history", "tags"]
|
|
36
37
|
|
|
37
38
|
@field_validator('include_chat_history')
|
|
@@ -83,6 +84,9 @@ class ChatSettings(BaseModel):
|
|
|
83
84
|
exclude=excluded_fields,
|
|
84
85
|
exclude_none=True,
|
|
85
86
|
)
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of tags
|
|
88
|
+
if self.tags:
|
|
89
|
+
_dict['tags'] = self.tags.to_dict()
|
|
86
90
|
return _dict
|
|
87
91
|
|
|
88
92
|
@classmethod
|
|
@@ -100,7 +104,7 @@ class ChatSettings(BaseModel):
|
|
|
100
104
|
"self_reflection_config": obj.get("self_reflection_config"),
|
|
101
105
|
"rag_config": obj.get("rag_config"),
|
|
102
106
|
"include_chat_history": obj.get("include_chat_history"),
|
|
103
|
-
"tags": obj.get("tags")
|
|
107
|
+
"tags": ChatSettingsTags.from_dict(obj["tags"]) if obj.get("tags") is not None else None
|
|
104
108
|
})
|
|
105
109
|
return _obj
|
|
106
110
|
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
|
|
@@ -18,8 +18,9 @@ import re # noqa: F401
|
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
20
|
from datetime import datetime
|
|
21
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from h2ogpte.rest_sync.models.guardrails_settings import GuardrailsSettings
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
25
26
|
|
|
@@ -31,10 +32,20 @@ class Extractor(BaseModel):
|
|
|
31
32
|
description: StrictStr = Field(description="What this extractor does")
|
|
32
33
|
llm: Optional[StrictStr] = Field(default=None, description="(Optional) Identifier or version of the language model the extractor uses")
|
|
33
34
|
var_schema: Optional[StrictStr] = Field(default=None, description="(Optional) JSONSchema (or other spec) that the extractor outputs", alias="schema")
|
|
35
|
+
prompt: Optional[StrictStr] = Field(default=None, description="(Optional) Prompt text for the extractor")
|
|
36
|
+
pre_prompt_summary: Optional[StrictStr] = Field(default=None, description="(Optional) Pre-prompt summary text for the extractor")
|
|
37
|
+
keep_intermediate_results: Optional[StrictBool] = Field(default=None, description="(Optional) Flag indicating whether to keep intermediate results during extraction")
|
|
38
|
+
system_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) System prompt text for the extractor")
|
|
39
|
+
max_num_chunks: Optional[StrictInt] = Field(default=None, description="(Optional) Maximum number of chunks to process")
|
|
40
|
+
vision: Optional[StrictStr] = Field(default=None, description="(Optional) Vision mode setting")
|
|
41
|
+
vision_llm: Optional[StrictStr] = Field(default=None, description="(Optional) Vision LLM model identifier")
|
|
42
|
+
image_batch_image_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) Image batch processing prompt")
|
|
43
|
+
image_batch_final_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) Final prompt for image batch processing")
|
|
44
|
+
guardrails_settings: Optional[GuardrailsSettings] = None
|
|
34
45
|
id: StrictStr = Field(description="Unique identifier of the extractor")
|
|
35
46
|
is_public: StrictBool = Field(description="Flag indicating if the extractor is public")
|
|
36
47
|
created_at: datetime = Field(description="When the extractor definition was created")
|
|
37
|
-
__properties: ClassVar[List[str]] = ["name", "description", "llm", "schema", "id", "is_public", "created_at"]
|
|
48
|
+
__properties: ClassVar[List[str]] = ["name", "description", "llm", "schema", "prompt", "pre_prompt_summary", "keep_intermediate_results", "system_prompt", "max_num_chunks", "vision", "vision_llm", "image_batch_image_prompt", "image_batch_final_prompt", "guardrails_settings", "id", "is_public", "created_at"]
|
|
38
49
|
|
|
39
50
|
model_config = ConfigDict(
|
|
40
51
|
populate_by_name=True,
|
|
@@ -75,6 +86,9 @@ class Extractor(BaseModel):
|
|
|
75
86
|
exclude=excluded_fields,
|
|
76
87
|
exclude_none=True,
|
|
77
88
|
)
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of guardrails_settings
|
|
90
|
+
if self.guardrails_settings:
|
|
91
|
+
_dict['guardrails_settings'] = self.guardrails_settings.to_dict()
|
|
78
92
|
return _dict
|
|
79
93
|
|
|
80
94
|
@classmethod
|
|
@@ -91,6 +105,16 @@ class Extractor(BaseModel):
|
|
|
91
105
|
"description": obj.get("description"),
|
|
92
106
|
"llm": obj.get("llm"),
|
|
93
107
|
"schema": obj.get("schema"),
|
|
108
|
+
"prompt": obj.get("prompt"),
|
|
109
|
+
"pre_prompt_summary": obj.get("pre_prompt_summary"),
|
|
110
|
+
"keep_intermediate_results": obj.get("keep_intermediate_results"),
|
|
111
|
+
"system_prompt": obj.get("system_prompt"),
|
|
112
|
+
"max_num_chunks": obj.get("max_num_chunks"),
|
|
113
|
+
"vision": obj.get("vision"),
|
|
114
|
+
"vision_llm": obj.get("vision_llm"),
|
|
115
|
+
"image_batch_image_prompt": obj.get("image_batch_image_prompt"),
|
|
116
|
+
"image_batch_final_prompt": obj.get("image_batch_final_prompt"),
|
|
117
|
+
"guardrails_settings": GuardrailsSettings.from_dict(obj["guardrails_settings"]) if obj.get("guardrails_settings") is not None else None,
|
|
94
118
|
"id": obj.get("id"),
|
|
95
119
|
"is_public": obj.get("is_public"),
|
|
96
120
|
"created_at": obj.get("created_at")
|
|
@@ -17,8 +17,9 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from h2ogpte.rest_sync.models.guardrails_settings import GuardrailsSettings
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -29,8 +30,18 @@ class ExtractorCreateRequest(BaseModel):
|
|
|
29
30
|
name: StrictStr = Field(description="Human-readable name")
|
|
30
31
|
description: StrictStr = Field(description="What this extractor does")
|
|
31
32
|
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
|
-
|
|
33
|
+
var_schema: StrictStr = Field(description="JSONSchema (or other spec) that the extractor outputs. When schema is valid and not empty, the output will be always returned as JSON object.", alias="schema")
|
|
34
|
+
prompt: Optional[StrictStr] = Field(default=None, description="Custom prompt text for the extractor. If empty, default prompt will be used. If combined with schema, prompt can customize the output, but cannot change its format as it will always be JSON object.")
|
|
35
|
+
pre_prompt_summary: Optional[StrictStr] = Field(default=None, description="(Optional) Pre-prompt summary text for the extractor")
|
|
36
|
+
keep_intermediate_results: Optional[StrictBool] = Field(default=None, description="(Optional) Flag indicating whether to keep intermediate results during extraction")
|
|
37
|
+
system_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) System prompt text for the extractor")
|
|
38
|
+
max_num_chunks: Optional[StrictInt] = Field(default=None, description="(Optional) Maximum number of chunks to process")
|
|
39
|
+
vision: Optional[StrictStr] = Field(default=None, description="(Optional) Vision mode setting")
|
|
40
|
+
vision_llm: Optional[StrictStr] = Field(default=None, description="(Optional) Vision LLM model identifier")
|
|
41
|
+
image_batch_image_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) Image batch processing prompt")
|
|
42
|
+
image_batch_final_prompt: Optional[StrictStr] = Field(default=None, description="(Optional) Final prompt for image batch processing")
|
|
43
|
+
guardrails_settings: Optional[GuardrailsSettings] = None
|
|
44
|
+
__properties: ClassVar[List[str]] = ["name", "description", "llm", "schema", "prompt", "pre_prompt_summary", "keep_intermediate_results", "system_prompt", "max_num_chunks", "vision", "vision_llm", "image_batch_image_prompt", "image_batch_final_prompt", "guardrails_settings"]
|
|
34
45
|
|
|
35
46
|
model_config = ConfigDict(
|
|
36
47
|
populate_by_name=True,
|
|
@@ -71,6 +82,9 @@ class ExtractorCreateRequest(BaseModel):
|
|
|
71
82
|
exclude=excluded_fields,
|
|
72
83
|
exclude_none=True,
|
|
73
84
|
)
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of guardrails_settings
|
|
86
|
+
if self.guardrails_settings:
|
|
87
|
+
_dict['guardrails_settings'] = self.guardrails_settings.to_dict()
|
|
74
88
|
return _dict
|
|
75
89
|
|
|
76
90
|
@classmethod
|
|
@@ -86,7 +100,17 @@ class ExtractorCreateRequest(BaseModel):
|
|
|
86
100
|
"name": obj.get("name"),
|
|
87
101
|
"description": obj.get("description"),
|
|
88
102
|
"llm": obj.get("llm"),
|
|
89
|
-
"schema": obj.get("schema")
|
|
103
|
+
"schema": obj.get("schema"),
|
|
104
|
+
"prompt": obj.get("prompt"),
|
|
105
|
+
"pre_prompt_summary": obj.get("pre_prompt_summary"),
|
|
106
|
+
"keep_intermediate_results": obj.get("keep_intermediate_results"),
|
|
107
|
+
"system_prompt": obj.get("system_prompt"),
|
|
108
|
+
"max_num_chunks": obj.get("max_num_chunks"),
|
|
109
|
+
"vision": obj.get("vision"),
|
|
110
|
+
"vision_llm": obj.get("vision_llm"),
|
|
111
|
+
"image_batch_image_prompt": obj.get("image_batch_image_prompt"),
|
|
112
|
+
"image_batch_final_prompt": obj.get("image_batch_final_prompt"),
|
|
113
|
+
"guardrails_settings": GuardrailsSettings.from_dict(obj["guardrails_settings"]) if obj.get("guardrails_settings") is not None else None
|
|
90
114
|
})
|
|
91
115
|
return _obj
|
|
92
116
|
|
|
@@ -17,7 +17,7 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from h2ogpte.rest_sync.models.confluence_credentials import ConfluenceCredentials
|
|
23
23
|
from typing import Optional, Set
|
|
@@ -29,9 +29,10 @@ class IngestFromConfluenceBody(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
base_url: StrictStr = Field(description="Base url of the confluence instance.")
|
|
31
31
|
page_ids: List[StrictStr] = Field(description="Ids of pages to be ingested.")
|
|
32
|
+
include_attachments: Optional[StrictBool] = Field(default=False, description="A flag indicating whether to also ingest attachments with the page.")
|
|
32
33
|
credentials: ConfluenceCredentials
|
|
33
34
|
metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata for the documents.")
|
|
34
|
-
__properties: ClassVar[List[str]] = ["base_url", "page_ids", "credentials", "metadata"]
|
|
35
|
+
__properties: ClassVar[List[str]] = ["base_url", "page_ids", "include_attachments", "credentials", "metadata"]
|
|
35
36
|
|
|
36
37
|
model_config = ConfigDict(
|
|
37
38
|
populate_by_name=True,
|
|
@@ -89,6 +90,7 @@ class IngestFromConfluenceBody(BaseModel):
|
|
|
89
90
|
_obj = cls.model_validate({
|
|
90
91
|
"base_url": obj.get("base_url"),
|
|
91
92
|
"page_ids": obj.get("page_ids"),
|
|
93
|
+
"include_attachments": obj.get("include_attachments") if obj.get("include_attachments") is not None else False,
|
|
92
94
|
"credentials": ConfluenceCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None,
|
|
93
95
|
"metadata": obj.get("metadata")
|
|
94
96
|
})
|
|
@@ -17,17 +17,18 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing import Optional, Set
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
25
|
-
class
|
|
25
|
+
class TagFilter(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
|
|
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
28
|
""" # noqa: E501
|
|
29
|
-
|
|
30
|
-
|
|
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"]
|
|
31
32
|
|
|
32
33
|
model_config = ConfigDict(
|
|
33
34
|
populate_by_name=True,
|
|
@@ -47,7 +48,7 @@ class CreateTopicModelJobRequest(BaseModel):
|
|
|
47
48
|
|
|
48
49
|
@classmethod
|
|
49
50
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
-
"""Create an instance of
|
|
51
|
+
"""Create an instance of TagFilter from a JSON string"""
|
|
51
52
|
return cls.from_dict(json.loads(json_str))
|
|
52
53
|
|
|
53
54
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -72,7 +73,7 @@ class CreateTopicModelJobRequest(BaseModel):
|
|
|
72
73
|
|
|
73
74
|
@classmethod
|
|
74
75
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
-
"""Create an instance of
|
|
76
|
+
"""Create an instance of TagFilter from a dict"""
|
|
76
77
|
if obj is None:
|
|
77
78
|
return None
|
|
78
79
|
|
|
@@ -80,7 +81,8 @@ class CreateTopicModelJobRequest(BaseModel):
|
|
|
80
81
|
return cls.model_validate(obj)
|
|
81
82
|
|
|
82
83
|
_obj = cls.model_validate({
|
|
83
|
-
"
|
|
84
|
+
"include": obj.get("include"),
|
|
85
|
+
"exclude": obj.get("exclude")
|
|
84
86
|
})
|
|
85
87
|
return _obj
|
|
86
88
|
|
h2ogpte/session.py
CHANGED
|
@@ -29,6 +29,7 @@ from h2ogpte.types import (
|
|
|
29
29
|
ChatResponse,
|
|
30
30
|
PartialChatMessage,
|
|
31
31
|
SessionError,
|
|
32
|
+
TagFilter,
|
|
32
33
|
)
|
|
33
34
|
from h2ogpte.errors import (
|
|
34
35
|
UnauthorizedError,
|
|
@@ -194,7 +195,7 @@ class Session:
|
|
|
194
195
|
self_reflection_config: Optional[Dict[str, Any]] = None,
|
|
195
196
|
rag_config: Optional[Dict[str, Any]] = None,
|
|
196
197
|
include_chat_history: Optional[Union[bool, str]] = "auto",
|
|
197
|
-
tags: Optional[List[str]] = None,
|
|
198
|
+
tags: Optional[Union[List[str], TagFilter]] = None,
|
|
198
199
|
metadata_filter: Optional[Dict[str, Any]] = None,
|
|
199
200
|
timeout: Optional[float] = None,
|
|
200
201
|
retries: int = 3,
|
|
@@ -328,6 +329,11 @@ class Session:
|
|
|
328
329
|
Requires 1 LLM or Agent call.
|
|
329
330
|
:code:`"agent_only"` Agent Only - Answer the query with only original files passed to agent.
|
|
330
331
|
Requires 1 Agent call.
|
|
332
|
+
:code:`"agentic_rag"` Agentic RAG - Agent with RAG tool that retrieves and answers from collection.
|
|
333
|
+
Requires 1 Agent call with RAG tool execution.
|
|
334
|
+
:code:`"rlm_rag"` RLM RAG - Agent programmatically analyzes documents using Python code
|
|
335
|
+
execution and sub-LLM calls. Best for complex multi-hop reasoning over large documents.
|
|
336
|
+
Requires 1 Agent call.
|
|
331
337
|
:code:`"rag"` RAG (Retrieval Augmented Generation) - Use supporting document contexts
|
|
332
338
|
to answer the query. Requires 1 LLM or Agent call.
|
|
333
339
|
:code:`"hyde1"` LLM Only + RAG composite - HyDE RAG (Hypothetical Document Embedding).
|
|
@@ -342,9 +348,6 @@ class Session:
|
|
|
342
348
|
:code:`"all_data"` All Data RAG - Like Summary RAG, but includes all document
|
|
343
349
|
chunks. Uses recursive summarization to overcome LLM context limits.
|
|
344
350
|
Can require several LLM calls.
|
|
345
|
-
:code:`"all_data"` All Data RAG - Like Summary RAG, but includes all document
|
|
346
|
-
chunks. Uses recursive summarization to overcome LLM context limits.
|
|
347
|
-
Can require several LLM calls.
|
|
348
351
|
hyde_no_rag_llm_prompt_extension: str
|
|
349
352
|
Add this prompt to every user's prompt, when generating answers to be used
|
|
350
353
|
for subsequent retrieval during HyDE. Only used when rag_type is "hyde1" or "hyde2".
|
|
@@ -382,7 +385,9 @@ class Session:
|
|
|
382
385
|
answers for a given question.
|
|
383
386
|
Choices are: ["on","off","auto",True,False]
|
|
384
387
|
tags:
|
|
385
|
-
|
|
388
|
+
Filter documents by tags for RAG. Can be:
|
|
389
|
+
- List format: ["red", "blue"] includes documents with these tags
|
|
390
|
+
- TagFilter object: TagFilter(include=["red"], exclude=["blue"])
|
|
386
391
|
metadata_filter:
|
|
387
392
|
A dictionary to filter documents by metadata, from which to pull the context for RAG.
|
|
388
393
|
timeout:
|
h2ogpte/session_async.py
CHANGED
|
@@ -30,6 +30,7 @@ from h2ogpte.types import (
|
|
|
30
30
|
ChatResponse,
|
|
31
31
|
SessionError,
|
|
32
32
|
PartialChatMessage,
|
|
33
|
+
TagFilter,
|
|
33
34
|
)
|
|
34
35
|
from h2ogpte.errors import (
|
|
35
36
|
UnauthorizedError,
|
|
@@ -108,7 +109,7 @@ class SessionAsync:
|
|
|
108
109
|
self_reflection_config: Optional[Dict[str, Any]] = None,
|
|
109
110
|
rag_config: Optional[Dict[str, Any]] = None,
|
|
110
111
|
include_chat_history: Optional[Union[bool, str]] = "auto",
|
|
111
|
-
tags: Optional[List[str]] = None,
|
|
112
|
+
tags: Optional[Union[List[str], TagFilter]] = None,
|
|
112
113
|
metadata_filter: Optional[Dict[str, Any]] = None,
|
|
113
114
|
timeout: Optional[float] = None,
|
|
114
115
|
retries: int = 3,
|
|
@@ -239,6 +240,11 @@ class SessionAsync:
|
|
|
239
240
|
Requires 1 LLM or Agent call.
|
|
240
241
|
:code:`"agent_only"` Agent Only - Answer the query with only original files passed to agent.
|
|
241
242
|
Requires 1 Agent call.
|
|
243
|
+
:code:`"agentic_rag"` Agentic RAG - Agent with RAG tool that retrieves and answers from collection.
|
|
244
|
+
Requires 1 Agent call with RAG tool execution.
|
|
245
|
+
:code:`"rlm_rag"` RLM RAG - Agent programmatically analyzes documents using Python code
|
|
246
|
+
execution and sub-LLM calls. Best for complex multi-hop reasoning over large documents.
|
|
247
|
+
Requires 1 Agent call.
|
|
242
248
|
:code:`"rag"` RAG (Retrieval Augmented Generation) - Use supporting document contexts
|
|
243
249
|
to answer the query. Requires 1 LLM or Agent call.
|
|
244
250
|
:code:`"hyde1"` LLM Only + RAG composite - HyDE RAG (Hypothetical Document Embedding).
|
|
@@ -290,7 +296,9 @@ class SessionAsync:
|
|
|
290
296
|
answers for a given question.
|
|
291
297
|
Choices are: ["on","off","auto",True,False]
|
|
292
298
|
tags:
|
|
293
|
-
|
|
299
|
+
Filter documents by tags for RAG. Can be:
|
|
300
|
+
- List format: ["red", "blue"] includes documents with these tags
|
|
301
|
+
- TagFilter object: TagFilter(include=["red"], exclude=["blue"])
|
|
294
302
|
metadata_filter:
|
|
295
303
|
A dictionary to filter documents by metadata, from which to pull the context for RAG.
|
|
296
304
|
timeout:
|
h2ogpte/types.py
CHANGED
|
@@ -259,9 +259,11 @@ class CollectionInfo(BaseModel):
|
|
|
259
259
|
id: str
|
|
260
260
|
name: str
|
|
261
261
|
description: str
|
|
262
|
+
embedding_model: str
|
|
262
263
|
document_count: int
|
|
263
264
|
document_size: int
|
|
264
265
|
updated_at: datetime
|
|
266
|
+
created_at: datetime
|
|
265
267
|
user_count: int
|
|
266
268
|
is_public: bool
|
|
267
269
|
username: str
|
|
@@ -306,6 +308,16 @@ class Extractor(BaseModel):
|
|
|
306
308
|
llm: Optional[str] = None
|
|
307
309
|
# can't use name schema as it conflicts with BaseModel's internals
|
|
308
310
|
extractor_schema: Optional[Dict[str, Any]] = None
|
|
311
|
+
prompt: Optional[str] = None
|
|
312
|
+
pre_prompt_summary: Optional[str] = None
|
|
313
|
+
keep_intermediate_results: Optional[bool] = None
|
|
314
|
+
system_prompt: Optional[str] = None
|
|
315
|
+
max_num_chunks: Optional[int] = None
|
|
316
|
+
vision: Optional[str] = None
|
|
317
|
+
vision_llm: Optional[str] = None
|
|
318
|
+
image_batch_image_prompt: Optional[str] = None
|
|
319
|
+
image_batch_final_prompt: Optional[str] = None
|
|
320
|
+
guardrails_settings: Optional[Dict[str, Any]] = None
|
|
309
321
|
is_public: bool
|
|
310
322
|
|
|
311
323
|
|
|
@@ -593,6 +605,21 @@ class APIKey(BaseModel):
|
|
|
593
605
|
is_global_key: bool
|
|
594
606
|
|
|
595
607
|
|
|
608
|
+
@dataclass
|
|
609
|
+
class TagFilter:
|
|
610
|
+
"""
|
|
611
|
+
Filter for document tags supporting inclusion and exclusion.
|
|
612
|
+
|
|
613
|
+
Examples:
|
|
614
|
+
TagFilter(include=['red', 'blue'])
|
|
615
|
+
TagFilter(exclude=['red', 'blue'])
|
|
616
|
+
TagFilter(include=['color'], exclude=['red', 'blue'])
|
|
617
|
+
"""
|
|
618
|
+
|
|
619
|
+
include: Optional[List[str]] = None
|
|
620
|
+
exclude: Optional[List[str]] = None
|
|
621
|
+
|
|
622
|
+
|
|
596
623
|
@dataclass
|
|
597
624
|
class ChatRequest:
|
|
598
625
|
t: str # cq
|
|
@@ -610,7 +637,7 @@ class ChatRequest:
|
|
|
610
637
|
self_reflection_config: Optional[str]
|
|
611
638
|
rag_config: Optional[str]
|
|
612
639
|
include_chat_history: Optional[Union[bool, str]] = False
|
|
613
|
-
tags: Optional[List[str]] = None
|
|
640
|
+
tags: Optional[Union[List[str], "TagFilter"]] = None
|
|
614
641
|
metadata_filter: Optional[str] = None
|
|
615
642
|
image_batch_image_prompt: Optional[str] = None
|
|
616
643
|
image_batch_final_prompt: Optional[str] = None
|