h2ogpte 1.6.42__py3-none-any.whl → 1.6.43rc1__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/cli/__init__.py +0 -0
- h2ogpte/cli/commands/__init__.py +0 -0
- h2ogpte/cli/commands/command_handlers/__init__.py +0 -0
- h2ogpte/cli/commands/command_handlers/agent.py +41 -0
- h2ogpte/cli/commands/command_handlers/chat.py +37 -0
- h2ogpte/cli/commands/command_handlers/clear.py +8 -0
- h2ogpte/cli/commands/command_handlers/collection.py +67 -0
- h2ogpte/cli/commands/command_handlers/config.py +113 -0
- h2ogpte/cli/commands/command_handlers/disconnect.py +36 -0
- h2ogpte/cli/commands/command_handlers/exit.py +37 -0
- h2ogpte/cli/commands/command_handlers/help.py +8 -0
- h2ogpte/cli/commands/command_handlers/history.py +29 -0
- h2ogpte/cli/commands/command_handlers/rag.py +146 -0
- h2ogpte/cli/commands/command_handlers/research_agent.py +45 -0
- h2ogpte/cli/commands/command_handlers/session.py +77 -0
- h2ogpte/cli/commands/command_handlers/status.py +33 -0
- h2ogpte/cli/commands/dispatcher.py +79 -0
- h2ogpte/cli/core/__init__.py +0 -0
- h2ogpte/cli/core/app.py +105 -0
- h2ogpte/cli/core/config.py +199 -0
- h2ogpte/cli/core/encryption.py +104 -0
- h2ogpte/cli/core/session.py +171 -0
- h2ogpte/cli/integrations/__init__.py +0 -0
- h2ogpte/cli/integrations/agent.py +338 -0
- h2ogpte/cli/integrations/rag.py +442 -0
- h2ogpte/cli/main.py +90 -0
- h2ogpte/cli/ui/__init__.py +0 -0
- h2ogpte/cli/ui/hbot_prompt.py +435 -0
- h2ogpte/cli/ui/prompts.py +129 -0
- h2ogpte/cli/ui/status_bar.py +133 -0
- h2ogpte/cli/utils/__init__.py +0 -0
- h2ogpte/cli/utils/file_manager.py +411 -0
- h2ogpte/h2ogpte.py +471 -67
- h2ogpte/h2ogpte_async.py +482 -68
- h2ogpte/h2ogpte_sync_base.py +8 -1
- h2ogpte/rest_async/__init__.py +6 -3
- h2ogpte/rest_async/api/chat_api.py +29 -0
- h2ogpte/rest_async/api/collections_api.py +293 -0
- h2ogpte/rest_async/api/extractors_api.py +2874 -70
- h2ogpte/rest_async/api/prompt_templates_api.py +32 -32
- h2ogpte/rest_async/api_client.py +1 -1
- h2ogpte/rest_async/configuration.py +1 -1
- h2ogpte/rest_async/models/__init__.py +5 -2
- h2ogpte/rest_async/models/chat_completion.py +4 -2
- h2ogpte/rest_async/models/chat_completion_delta.py +5 -3
- h2ogpte/rest_async/models/chat_completion_request.py +1 -1
- h2ogpte/rest_async/models/chat_session.py +4 -2
- h2ogpte/rest_async/models/chat_settings.py +1 -1
- h2ogpte/rest_async/models/collection.py +4 -2
- h2ogpte/rest_async/models/collection_create_request.py +4 -2
- h2ogpte/rest_async/models/create_chat_session_request.py +87 -0
- h2ogpte/rest_async/models/extraction_request.py +1 -1
- h2ogpte/rest_async/models/extractor.py +4 -2
- h2ogpte/rest_async/models/guardrails_settings.py +8 -4
- h2ogpte/rest_async/models/guardrails_settings_create_request.py +1 -1
- h2ogpte/rest_async/models/process_document_job_request.py +1 -1
- h2ogpte/rest_async/models/question_request.py +1 -1
- h2ogpte/rest_async/models/{reset_and_share_prompt_template_request.py → reset_and_share_request.py} +6 -6
- h2ogpte/{rest_sync/models/reset_and_share_prompt_template_with_groups_request.py → rest_async/models/reset_and_share_with_groups_request.py} +6 -6
- h2ogpte/rest_async/models/summarize_request.py +1 -1
- h2ogpte/rest_async/models/update_collection_workspace_request.py +87 -0
- h2ogpte/rest_async/models/update_extractor_privacy_request.py +87 -0
- h2ogpte/rest_sync/__init__.py +6 -3
- h2ogpte/rest_sync/api/chat_api.py +29 -0
- h2ogpte/rest_sync/api/collections_api.py +293 -0
- h2ogpte/rest_sync/api/extractors_api.py +2874 -70
- h2ogpte/rest_sync/api/prompt_templates_api.py +32 -32
- h2ogpte/rest_sync/api_client.py +1 -1
- h2ogpte/rest_sync/configuration.py +1 -1
- h2ogpte/rest_sync/models/__init__.py +5 -2
- h2ogpte/rest_sync/models/chat_completion.py +4 -2
- h2ogpte/rest_sync/models/chat_completion_delta.py +5 -3
- h2ogpte/rest_sync/models/chat_completion_request.py +1 -1
- h2ogpte/rest_sync/models/chat_session.py +4 -2
- h2ogpte/rest_sync/models/chat_settings.py +1 -1
- h2ogpte/rest_sync/models/collection.py +4 -2
- h2ogpte/rest_sync/models/collection_create_request.py +4 -2
- h2ogpte/rest_sync/models/create_chat_session_request.py +87 -0
- h2ogpte/rest_sync/models/extraction_request.py +1 -1
- h2ogpte/rest_sync/models/extractor.py +4 -2
- h2ogpte/rest_sync/models/guardrails_settings.py +8 -4
- h2ogpte/rest_sync/models/guardrails_settings_create_request.py +1 -1
- h2ogpte/rest_sync/models/process_document_job_request.py +1 -1
- h2ogpte/rest_sync/models/question_request.py +1 -1
- h2ogpte/rest_sync/models/{reset_and_share_prompt_template_request.py → reset_and_share_request.py} +6 -6
- h2ogpte/{rest_async/models/reset_and_share_prompt_template_with_groups_request.py → rest_sync/models/reset_and_share_with_groups_request.py} +6 -6
- h2ogpte/rest_sync/models/summarize_request.py +1 -1
- h2ogpte/rest_sync/models/update_collection_workspace_request.py +87 -0
- h2ogpte/rest_sync/models/update_extractor_privacy_request.py +87 -0
- h2ogpte/session.py +3 -2
- h2ogpte/session_async.py +22 -6
- h2ogpte/types.py +6 -0
- {h2ogpte-1.6.42.dist-info → h2ogpte-1.6.43rc1.dist-info}/METADATA +5 -1
- {h2ogpte-1.6.42.dist-info → h2ogpte-1.6.43rc1.dist-info}/RECORD +98 -59
- h2ogpte-1.6.43rc1.dist-info/entry_points.txt +2 -0
- {h2ogpte-1.6.42.dist-info → h2ogpte-1.6.43rc1.dist-info}/WHEEL +0 -0
- {h2ogpte-1.6.42.dist-info → h2ogpte-1.6.43rc1.dist-info}/top_level.txt +0 -0
h2ogpte/h2ogpte.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This file was generated from `h2ogpte_async.py` by executing `make generate-sync-mux-py`.
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Iterable, Any, Union, List, Dict, Tuple
|
|
4
|
+
from typing import Iterable, Any, Union, List, Dict, Tuple, Callable
|
|
5
5
|
from h2ogpte.types import *
|
|
6
6
|
from h2ogpte.errors import *
|
|
7
7
|
from h2ogpte.connectors import *
|
|
@@ -92,19 +92,65 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
92
92
|
Default value is to use the first model (0th index).
|
|
93
93
|
llm_args:
|
|
94
94
|
Dictionary of kwargs to pass to the llm. Valid keys:
|
|
95
|
+
# Core generation parameters
|
|
95
96
|
temperature (float, default: 0) — The value used to modulate the next token probabilities. Most deterministic: 0, Most creative: 1
|
|
96
|
-
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
97
|
-
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
98
|
-
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
99
|
-
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
100
|
-
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
101
|
-
min_max_new_tokens (int, default: 512) —
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
98
|
+
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
99
|
+
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
100
|
+
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
101
|
+
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
102
|
+
min_max_new_tokens (int, default: 512) — Minimum value for max_new_tokens when auto-adjusting for content of prompt, docs, etc.
|
|
103
|
+
min_chars_per_yield (int) — Minimum number of characters to yield at a time during streaming
|
|
104
|
+
reasoning_effort (int, default: 0) — Level of reasoning effort for the model (higher values = deeper reasoning, e.g., 10000-65000). Use for models that support chain-of-thought reasoning. 0 means no additional reasoning effort
|
|
105
|
+
|
|
106
|
+
# Output format parameters
|
|
107
|
+
response_format (str, default: "text") — Output type, one of ["text", "json_object", "json_code"]
|
|
108
|
+
guided_json (dict, default: None) — If specified, the output will follow the JSON schema
|
|
109
|
+
guided_regex (str, default: "") — If specified, the output will follow the regex pattern. Only for models that support guided generation: check output of get_llms() for guided_vllm flag
|
|
110
|
+
guided_choice (Optional[List[str]], default: None) — If specified, the output will be exactly one of the choices. Only for models that support guided generation
|
|
111
|
+
guided_grammar (str, default: "") — If specified, the output will follow the context free grammar. Only for models that support guided generation
|
|
112
|
+
guided_whitespace_pattern (str, default: "") — If specified, will override the default whitespace pattern for guided json decoding. Only for models that support guided generation
|
|
113
|
+
json_preserve_system_prompt (bool) — Whether to preserve the system prompt when using JSON response format
|
|
114
|
+
|
|
115
|
+
# Vision and image parameters
|
|
116
|
+
images_num_max (int) — Maximum number of images to process
|
|
117
|
+
visible_vision_models (list) — List of vision models that can be used
|
|
118
|
+
|
|
119
|
+
# Agent parameters
|
|
120
|
+
use_agent (bool, default: False) — Whether to enable agent functionality for advanced task processing with access to tools
|
|
121
|
+
shared_agent (bool, default: False) — Whether to use shared agent instance across multiple requests for efficiency
|
|
122
|
+
agent_type (str, default: "auto") — Type of agent to use. Options: ["auto", "agent_analysis", "agent_chat_history_md", "agent_code", "agent_rag"]
|
|
123
|
+
selected_tool_type (str, default: "auto") — Type of tools to make available to the agent. Options: ["auto", "all", "any"] or specific tool names
|
|
124
|
+
agent_accuracy (str, default: "standard") — Accuracy level for agent operations. Options:
|
|
125
|
+
"quick" - Fastest, less verification (max_turns=10, timeout=30s)
|
|
126
|
+
"basic" - Best for simple tasks (max_turns=20, timeout=60s)
|
|
127
|
+
"standard" - Good for most tasks (max_turns=40, timeout=120s)
|
|
128
|
+
"maximum" - Highest accuracy, can take a long time (max_turns=80, timeout=240s)
|
|
129
|
+
agent_max_turns (Union[str, int], default: "auto") — Maximum number of back-and-forth turns the agent can take. Either "auto" or an integer
|
|
130
|
+
agent_original_files (list) — List of file paths for agent to process and analyze
|
|
131
|
+
agent_timeout (int) — Timeout in seconds for each individual agent turn/operation
|
|
132
|
+
agent_total_timeout (int, default: 3600) — Total timeout in seconds for all agent operations combined
|
|
133
|
+
agent_min_time (int) — Minimum time in seconds to run the agent before allowing completion
|
|
134
|
+
agent_tools (Union[str, list], default: "auto") — List of specific tools available to the agent. Options: "auto", "all", "any", or list of tool names
|
|
135
|
+
user_persona (str) — User persona description for agent context to customize agent behavior
|
|
136
|
+
agent_code_writer_system_message (str) — Custom system message for code writing agent to guide code generation
|
|
137
|
+
agent_code_restrictions_level (int) — Level of code execution restrictions for agent (typically 0 for unrestricted)
|
|
138
|
+
agent_num_executable_code_blocks_limit (int) — Maximum number of code blocks the agent can execute in a single session
|
|
139
|
+
agent_system_site_packages (bool, default: False) — Whether agent can use system site packages when executing code
|
|
140
|
+
agent_main_model (str) — Main model to use for agent operations (e.g., specific LLM name)
|
|
141
|
+
agent_max_stream_length (int, default: -1) — Maximum length for agent streaming responses, -1 for unlimited
|
|
142
|
+
agent_max_memory_usage (int) — Maximum memory usage in bytes for agent operations
|
|
143
|
+
agent_main_reasoning_effort (int) — Level of reasoning effort for main agent model (higher values = more reasoning, e.g., 10000)
|
|
144
|
+
agent_advanced_reasoning_effort (int) — Level of reasoning effort for advanced agent operations (e.g., 20000)
|
|
145
|
+
agent_max_confidence_level (int) — Maximum confidence level for agent decisions (typically 0, 1, or 2)
|
|
146
|
+
agent_planning_forced_mode (bool) — Whether to force planning mode for agent (True to always plan first)
|
|
147
|
+
agent_too_soon_forced_mode (bool) — Whether to force handling of premature agent decisions
|
|
148
|
+
agent_critique_forced_mode (int) — Whether to force critique mode for agent self-evaluation
|
|
149
|
+
agent_stream_files (bool, default: True) — Whether to stream files from agent operations for real-time updates
|
|
150
|
+
|
|
151
|
+
# Other parameters
|
|
152
|
+
max_time (int) — Maximum time in seconds for the operation
|
|
153
|
+
client_metadata (dict) — Metadata to include with the request
|
|
108
154
|
chat_conversation:
|
|
109
155
|
List of tuples for (human, bot) conversation that will be pre-appended
|
|
110
156
|
to an (question, None) case for a query.
|
|
@@ -216,18 +262,19 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
216
262
|
llm_args:
|
|
217
263
|
Dictionary of kwargs to pass to the llm. Valid keys:
|
|
218
264
|
temperature (float, default: 0) — The value used to modulate the next token probabilities. Most deterministic: 0, Most creative: 1
|
|
219
|
-
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
220
|
-
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
221
|
-
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
222
|
-
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
223
|
-
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
224
|
-
min_max_new_tokens (int, default: 512) —
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
265
|
+
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
266
|
+
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
267
|
+
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
268
|
+
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
269
|
+
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
270
|
+
min_max_new_tokens (int, default: 512) — Minimum value for max_new_tokens when auto-adjusting for content of prompt, docs, etc.
|
|
271
|
+
reasoning_effort (int, default: 0) — Level of reasoning effort for the model (higher values = deeper reasoning, e.g., 10000-65000). Use for models that support chain-of-thought reasoning. 0 means no additional reasoning effort
|
|
272
|
+
response_format (str, default: "text") — Output type, one of ["text", "json_object", "json_code"]
|
|
273
|
+
guided_json (dict, default: None) — If specified, the output will follow the JSON schema
|
|
274
|
+
guided_regex (str, default: "") — If specified, the output will follow the regex pattern. Only for models that support guided generation
|
|
275
|
+
guided_choice (Optional[List[str]], default: None) — If specified, the output will be exactly one of the choices. Only for models that support guided generation
|
|
276
|
+
guided_grammar (str, default: "") — If specified, the output will follow the context free grammar. Only for models that support guided generation
|
|
277
|
+
guided_whitespace_pattern (str, default: "") — If specified, will override the default whitespace pattern for guided json decoding. Only for models that support guided generation
|
|
231
278
|
guardrails_settings:
|
|
232
279
|
Guardrails Settings.
|
|
233
280
|
timeout:
|
|
@@ -326,18 +373,19 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
326
373
|
llm_args:
|
|
327
374
|
Dictionary of kwargs to pass to the llm. Valid keys:
|
|
328
375
|
temperature (float, default: 0) — The value used to modulate the next token probabilities. Most deterministic: 0, Most creative: 1
|
|
329
|
-
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
330
|
-
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
331
|
-
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
332
|
-
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
333
|
-
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
334
|
-
min_max_new_tokens (int, default: 512) —
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
376
|
+
seed (int, default: 0) — The seed for the random number generator, only used if temperature > 0, seed=0 will pick a random number for each call, seed > 0 will be fixed
|
|
377
|
+
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
378
|
+
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
379
|
+
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
380
|
+
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
381
|
+
min_max_new_tokens (int, default: 512) — Minimum value for max_new_tokens when auto-adjusting for content of prompt, docs, etc.
|
|
382
|
+
reasoning_effort (int, default: 0) — Level of reasoning effort for the model (higher values = deeper reasoning, e.g., 10000-65000). Use for models that support chain-of-thought reasoning. 0 means no additional reasoning effort
|
|
383
|
+
response_format (str, default: "text") — Output type, one of ["text", "json_object", "json_code"]
|
|
384
|
+
guided_json (dict, default: None) — If specified, the output will follow the JSON schema
|
|
385
|
+
guided_regex (str, default: "") — If specified, the output will follow the regex pattern. Only for models that support guided generation
|
|
386
|
+
guided_choice (Optional[List[str]], default: None) — If specified, the output will be exactly one of the choices. Only for models that support guided generation
|
|
387
|
+
guided_grammar (str, default: "") — If specified, the output will follow the context free grammar. Only for models that support guided generation
|
|
388
|
+
guided_whitespace_pattern (str, default: "") — If specified, will override the default whitespace pattern for guided json decoding. Only for models that support guided generation
|
|
341
389
|
guardrails_settings:
|
|
342
390
|
Guardrails Settings.
|
|
343
391
|
timeout:
|
|
@@ -649,13 +697,18 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
649
697
|
)
|
|
650
698
|
return result
|
|
651
699
|
|
|
652
|
-
def create_chat_session(
|
|
700
|
+
def create_chat_session(
|
|
701
|
+
self, collection_id: Optional[str] = None, workspace: Optional[str] = None
|
|
702
|
+
) -> str:
|
|
653
703
|
"""Creates a new chat session for asking questions (of documents).
|
|
654
704
|
|
|
655
705
|
Args:
|
|
656
706
|
collection_id:
|
|
657
707
|
String id of the collection to chat with.
|
|
658
708
|
If None, chat with LLM directly.
|
|
709
|
+
workspace:
|
|
710
|
+
String id of the workspace this chat will be associated with.
|
|
711
|
+
If None, the user's default workspace will be used.
|
|
659
712
|
|
|
660
713
|
Returns:
|
|
661
714
|
str: The ID of the newly created chat session.
|
|
@@ -664,7 +717,11 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
664
717
|
with self._RESTClient(self) as rest_client:
|
|
665
718
|
response = _rest_to_client_exceptions(
|
|
666
719
|
lambda: rest_client.chat_api.create_chat_session(
|
|
667
|
-
collection_id=collection_id,
|
|
720
|
+
collection_id=collection_id,
|
|
721
|
+
create_chat_session_request=rest.CreateChatSessionRequest(
|
|
722
|
+
workspace=workspace,
|
|
723
|
+
),
|
|
724
|
+
_headers=header,
|
|
668
725
|
)
|
|
669
726
|
)
|
|
670
727
|
return response.id
|
|
@@ -679,7 +736,8 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
679
736
|
with self._RESTClient(self) as rest_client:
|
|
680
737
|
response = _rest_to_client_exceptions(
|
|
681
738
|
lambda: rest_client.chat_api.create_chat_session(
|
|
682
|
-
collection_id="default",
|
|
739
|
+
collection_id="default",
|
|
740
|
+
_headers=header,
|
|
683
741
|
)
|
|
684
742
|
)
|
|
685
743
|
return response.id
|
|
@@ -766,6 +824,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
766
824
|
collection_settings: Union[dict, None] = None,
|
|
767
825
|
thumbnail: Union[Path, None] = None,
|
|
768
826
|
chat_settings: Union[dict, None] = None,
|
|
827
|
+
workspace: Union[str, None] = None,
|
|
769
828
|
) -> str:
|
|
770
829
|
r"""Creates a new collection.
|
|
771
830
|
|
|
@@ -812,8 +871,8 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
812
871
|
guardrails_labels_to_flag: list of entities to be flagged as safety violations in user prompts. Must be a subset of guardrails_entities, if provided.
|
|
813
872
|
guardrails_safe_category: (Optional) name of the safe category for guardrails. Must be a key in guardrails_entities, if provided. Otherwise uses system defaults.
|
|
814
873
|
guardrails_entities: (Optional) dictionary of entities and their descriptions for the guardrails model to classify. The first entry is the "safe" class, the rest are "unsafe" classes.
|
|
815
|
-
|
|
816
|
-
|
|
874
|
+
custom_pii_entities_to_flag: list of entities to redact in tabular data files. Must be a subset of custom_pii_entities, if provided.
|
|
875
|
+
custom_pii_entities: (Optional) dictionary of entities and a short description for the LLM to check for and redact columns containing PII in tabular data files.
|
|
817
876
|
guardrails_llm: LLM to use for guardrails and PII detection. Use "auto" for automatic. Use `H2OGPTE.get_llms()` to see all available options.
|
|
818
877
|
Example:
|
|
819
878
|
Note: Call client.get_guardrails_settings() to see all options for guardrails_settings.
|
|
@@ -845,10 +904,10 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
845
904
|
"Intellectual Property": "Messages that may violate the intellectual property rights of any third party",
|
|
846
905
|
"Code Interpreter Abuse": "Messages that seek to abuse code interpreters, including those that enable denial of service attacks, container escapes or privilege escalation exploits",
|
|
847
906
|
},
|
|
848
|
-
|
|
907
|
+
custom_pii_entities_to_flag=[
|
|
849
908
|
"Mother's Maiden Name"
|
|
850
909
|
],
|
|
851
|
-
|
|
910
|
+
custom_pii_entities={
|
|
852
911
|
"Mother's Maiden Name": "Mother's maiden name."
|
|
853
912
|
},
|
|
854
913
|
guardrails_llm="meta-llama/Llama-3.3-70B-Instruct",
|
|
@@ -859,12 +918,14 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
859
918
|
chat_settings:
|
|
860
919
|
(Optional) Dictionary with key/value pairs to configure the default values for certain chat specific settings
|
|
861
920
|
The following keys are supported, see the client.session() documentation for more details.
|
|
862
|
-
llm: str
|
|
863
|
-
llm_args: dict
|
|
864
|
-
self_reflection_config: dict
|
|
865
|
-
rag_config: dict
|
|
866
|
-
include_chat_history: bool
|
|
867
|
-
tags: list[str]
|
|
921
|
+
llm: str — Default LLM to use for chat sessions in this collection
|
|
922
|
+
llm_args: dict — Default LLM arguments (see answer_question method for full list of valid keys)
|
|
923
|
+
self_reflection_config: dict — Configuration for self-reflection functionality
|
|
924
|
+
rag_config: dict — Configuration for RAG (Retrieval-Augmented Generation)
|
|
925
|
+
include_chat_history: bool — Whether to include chat history in context
|
|
926
|
+
tags: list[str] — Tags to associate with the collection
|
|
927
|
+
workspace:
|
|
928
|
+
(Optional) The workspace id to be associated with this collection. None to use the default workspace.
|
|
868
929
|
Returns:
|
|
869
930
|
str: The ID of the newly created collection.
|
|
870
931
|
"""
|
|
@@ -878,6 +939,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
878
939
|
collection_settings
|
|
879
940
|
),
|
|
880
941
|
chat_settings=rest.ChatSettings.from_dict(chat_settings),
|
|
942
|
+
workspace=workspace,
|
|
881
943
|
)
|
|
882
944
|
collection = _rest_to_client_exceptions(
|
|
883
945
|
lambda: rest_client.collection_api.create_collection(
|
|
@@ -1561,20 +1623,21 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
1561
1623
|
llm_args:
|
|
1562
1624
|
Dictionary of kwargs to pass to the llm. Valid keys:
|
|
1563
1625
|
temperature (float, default: 0) — The value used to modulate the next token probabilities. Most deterministic: 0, Most creative: 1
|
|
1564
|
-
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
1565
|
-
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
1566
|
-
seed (int, default: 0) — The seed for the random number generator when sampling during generation (if temp>0 or top_k>1 or top_p<1), seed=0 picks a random seed
|
|
1567
|
-
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
1568
|
-
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1626
|
+
top_k (int, default: 1) — The number of highest probability vocabulary tokens to keep for top-k-filtering
|
|
1627
|
+
top_p (float, default: 1.0) — If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation
|
|
1628
|
+
seed (int, default: 0) — The seed for the random number generator when sampling during generation (if temp>0 or top_k>1 or top_p<1), seed=0 picks a random seed
|
|
1629
|
+
repetition_penalty (float, default: 1.07) — The parameter for repetition penalty. 1.0 means no penalty
|
|
1630
|
+
max_new_tokens (int, default: 1024) — Maximum number of new tokens to generate. This limit applies to each (map+reduce) step during summarization and each (map) step during extraction
|
|
1631
|
+
reasoning_effort (int, default: 0) — Level of reasoning effort for the model (higher values = deeper reasoning, e.g., 10000-65000). Use for models that support chain-of-thought reasoning. 0 means no additional reasoning effort
|
|
1632
|
+
min_max_new_tokens (int, default: 512) — Minimum value for max_new_tokens when auto-adjusting for content of prompt, docs, etc.
|
|
1633
|
+
response_format (str, default: "text") — Output type, one of ["text", "json_object", "json_code"]
|
|
1634
|
+
guided_json (dict, default: None) — If specified, the output will follow the JSON schema
|
|
1635
|
+
guided_regex (str, default: "") — If specified, the output will follow the regex pattern. Only for models that support guided generation
|
|
1636
|
+
guided_choice (Optional[List[str]], default: None) — If specified, the output will be exactly one of the choices. Only for models that support guided generation
|
|
1637
|
+
guided_grammar (str, default: "") — If specified, the output will follow the context free grammar. Only for models that support guided generation
|
|
1638
|
+
guided_whitespace_pattern (str, default: "") — If specified, will override the default whitespace pattern for guided json decoding. Only for models that support guided generation
|
|
1639
|
+
enable_vision (str, default: "auto") — Controls vision mode, send images to the LLM in addition to text chunks. Only if have models that support vision, use get_vision_capable_llm_names() to see list. One of ["on", "off", "auto"]
|
|
1640
|
+
visible_vision_models (List[str], default: ["auto"]) — Controls which vision model to use when processing images. Use get_vision_capable_llm_names() to see list. Must provide exactly one model. ["auto"] for automatic
|
|
1578
1641
|
max_num_chunks:
|
|
1579
1642
|
Max limit of chunks to send to the summarizer
|
|
1580
1643
|
sampling_strategy:
|
|
@@ -2531,6 +2594,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
2531
2594
|
metadata: Union[Dict[str, Any], None] = None,
|
|
2532
2595
|
timeout: Union[float, None] = None,
|
|
2533
2596
|
ingest_mode: Union[str, None] = None,
|
|
2597
|
+
callback: Optional[Callable[[Job], None]] = None,
|
|
2534
2598
|
) -> Job:
|
|
2535
2599
|
"""Add uploaded documents into a specific collection.
|
|
2536
2600
|
|
|
@@ -2577,6 +2641,8 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
2577
2641
|
"standard" - Files will be ingested for use with RAG
|
|
2578
2642
|
"lite" - Files will be ingested for use with RAG, but minimal processing will be done, favoring ingest speed over accuracy
|
|
2579
2643
|
"agent_only" - Bypasses standard ingestion. Files can only be used with agents.
|
|
2644
|
+
callback:
|
|
2645
|
+
Function for processing job status info during the upload.
|
|
2580
2646
|
"""
|
|
2581
2647
|
header = self._get_auth_header()
|
|
2582
2648
|
with self._RESTClient(self) as rest_client:
|
|
@@ -2604,7 +2670,9 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
2604
2670
|
_headers=header,
|
|
2605
2671
|
)
|
|
2606
2672
|
)
|
|
2607
|
-
return self._wait_for_completion(
|
|
2673
|
+
return self._wait_for_completion(
|
|
2674
|
+
response.id, timeout=timeout, callback=callback
|
|
2675
|
+
)
|
|
2608
2676
|
|
|
2609
2677
|
def ingest_website(
|
|
2610
2678
|
self,
|
|
@@ -3723,6 +3791,298 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
3723
3791
|
)
|
|
3724
3792
|
return result
|
|
3725
3793
|
|
|
3794
|
+
def list_extractor_permissions(self, extractor_id: str) -> List[SharePermission]:
|
|
3795
|
+
"""Returns a list of access permissions for a given extractor.
|
|
3796
|
+
|
|
3797
|
+
The returned list of permissions denotes who has access to
|
|
3798
|
+
the extractor and their access level.
|
|
3799
|
+
|
|
3800
|
+
Args:
|
|
3801
|
+
extractor_id:
|
|
3802
|
+
ID of the extractor to inspect.
|
|
3803
|
+
|
|
3804
|
+
Returns:
|
|
3805
|
+
list of SharePermission: Sharing permissions list for the given extractor.
|
|
3806
|
+
"""
|
|
3807
|
+
header = self._get_auth_header()
|
|
3808
|
+
with self._RESTClient(self) as rest_client:
|
|
3809
|
+
response = _rest_to_client_exceptions(
|
|
3810
|
+
lambda: rest_client.extractor_api.get_extractor_permissions(
|
|
3811
|
+
extractor_id=extractor_id,
|
|
3812
|
+
_headers=header,
|
|
3813
|
+
)
|
|
3814
|
+
)
|
|
3815
|
+
return [SharePermission(**d.to_dict()) for d in response]
|
|
3816
|
+
|
|
3817
|
+
def list_extractor_group_permissions(
|
|
3818
|
+
self, extractor_id: str
|
|
3819
|
+
) -> List[GroupSharePermission]:
|
|
3820
|
+
"""Returns a list of group access permissions for a given extractor.
|
|
3821
|
+
|
|
3822
|
+
The returned list of group permissions denoting which groups have access to
|
|
3823
|
+
the extractor and their access level.
|
|
3824
|
+
|
|
3825
|
+
Args:
|
|
3826
|
+
extractor_id:
|
|
3827
|
+
ID of the extractor to inspect.
|
|
3828
|
+
|
|
3829
|
+
Returns:
|
|
3830
|
+
list of GroupSharePermission: Group sharing permissions list for the given extractor.
|
|
3831
|
+
"""
|
|
3832
|
+
header = self._get_auth_header()
|
|
3833
|
+
with self._RESTClient(self) as rest_client:
|
|
3834
|
+
response = _rest_to_client_exceptions(
|
|
3835
|
+
lambda: rest_client.extractor_api.get_extractor_group_permissions(
|
|
3836
|
+
extractor_id=extractor_id,
|
|
3837
|
+
_headers=header,
|
|
3838
|
+
)
|
|
3839
|
+
)
|
|
3840
|
+
return [GroupSharePermission(**d.to_dict()) for d in response]
|
|
3841
|
+
|
|
3842
|
+
def share_extractor(
|
|
3843
|
+
self, extractor_id: str, permission: SharePermission
|
|
3844
|
+
) -> ShareResponseStatus:
|
|
3845
|
+
"""Share an extractor to a user.
|
|
3846
|
+
|
|
3847
|
+
The permission attribute defined the level of access,
|
|
3848
|
+
and who can access the extractor, the extractor_id attribute
|
|
3849
|
+
denotes the extractor to be shared.
|
|
3850
|
+
|
|
3851
|
+
Args:
|
|
3852
|
+
extractor_id:
|
|
3853
|
+
ID of the extractor to share.
|
|
3854
|
+
permission:
|
|
3855
|
+
Defines the rule for sharing, i.e. permission level.
|
|
3856
|
+
|
|
3857
|
+
Returns:
|
|
3858
|
+
ShareResponseStatus: Status of share request.
|
|
3859
|
+
"""
|
|
3860
|
+
header = self._get_auth_header()
|
|
3861
|
+
with self._RESTClient(self) as rest_client:
|
|
3862
|
+
result = _get_share_permission_status(
|
|
3863
|
+
lambda: _rest_to_client_exceptions(
|
|
3864
|
+
lambda: rest_client.extractor_api.share_extractor(
|
|
3865
|
+
extractor_id=extractor_id,
|
|
3866
|
+
username=permission.username,
|
|
3867
|
+
_headers=header,
|
|
3868
|
+
)
|
|
3869
|
+
)
|
|
3870
|
+
)
|
|
3871
|
+
return result
|
|
3872
|
+
|
|
3873
|
+
def unshare_extractor(
|
|
3874
|
+
self, extractor_id: str, permission: SharePermission
|
|
3875
|
+
) -> ShareResponseStatus:
|
|
3876
|
+
"""Remove sharing of an extractor to a user.
|
|
3877
|
+
|
|
3878
|
+
The permission attribute defined the level of access,
|
|
3879
|
+
and who can access the extractor, the extractor_id attribute
|
|
3880
|
+
denotes the extractor to be shared.
|
|
3881
|
+
|
|
3882
|
+
In case of un-sharing, the SharePermission's user is sufficient.
|
|
3883
|
+
|
|
3884
|
+
Args:
|
|
3885
|
+
extractor_id:
|
|
3886
|
+
ID of the extractor to un-share.
|
|
3887
|
+
permission:
|
|
3888
|
+
Defines the user for which extractor access is revoked.
|
|
3889
|
+
|
|
3890
|
+
ShareResponseStatus: Status of share request.
|
|
3891
|
+
"""
|
|
3892
|
+
header = self._get_auth_header()
|
|
3893
|
+
with self._RESTClient(self) as rest_client:
|
|
3894
|
+
result = _get_share_permission_status(
|
|
3895
|
+
lambda: _rest_to_client_exceptions(
|
|
3896
|
+
lambda: rest_client.extractor_api.unshare_extractor(
|
|
3897
|
+
extractor_id=extractor_id,
|
|
3898
|
+
username=permission.username,
|
|
3899
|
+
_headers=header,
|
|
3900
|
+
)
|
|
3901
|
+
)
|
|
3902
|
+
)
|
|
3903
|
+
return result
|
|
3904
|
+
|
|
3905
|
+
def reset_and_share_extractor(
|
|
3906
|
+
self, extractor_id: str, new_usernames: List[str]
|
|
3907
|
+
) -> ShareResponseStatus:
|
|
3908
|
+
"""Remove all users who have access to an extractor (except for the owner) and share it with the provided list of new users.
|
|
3909
|
+
|
|
3910
|
+
Args:
|
|
3911
|
+
extractor_id:
|
|
3912
|
+
ID of the extractor to un-share.
|
|
3913
|
+
new_usernames:
|
|
3914
|
+
The list of usernames belonging to the users this extractor will be shared with.
|
|
3915
|
+
|
|
3916
|
+
ShareResponseStatus: Status of share request.
|
|
3917
|
+
"""
|
|
3918
|
+
header = self._get_auth_header()
|
|
3919
|
+
with self._RESTClient(self) as rest_client:
|
|
3920
|
+
result = _get_share_permission_status(
|
|
3921
|
+
lambda: _rest_to_client_exceptions(
|
|
3922
|
+
lambda: rest_client.extractor_api.reset_and_share_extractor(
|
|
3923
|
+
extractor_id=extractor_id,
|
|
3924
|
+
reset_and_share_request=rest.ResetAndShareRequest(
|
|
3925
|
+
usernames=new_usernames,
|
|
3926
|
+
),
|
|
3927
|
+
_headers=header,
|
|
3928
|
+
)
|
|
3929
|
+
)
|
|
3930
|
+
)
|
|
3931
|
+
return result
|
|
3932
|
+
|
|
3933
|
+
def unshare_extractor_for_all(self, extractor_id: str) -> ShareResponseStatus:
|
|
3934
|
+
"""Remove sharing of an extractor to all other users but the original owner.
|
|
3935
|
+
|
|
3936
|
+
Args:
|
|
3937
|
+
extractor_id:
|
|
3938
|
+
ID of the extractor to un-share.
|
|
3939
|
+
|
|
3940
|
+
ShareResponseStatus: Status of share request.
|
|
3941
|
+
"""
|
|
3942
|
+
header = self._get_auth_header()
|
|
3943
|
+
with self._RESTClient(self) as rest_client:
|
|
3944
|
+
result = _get_share_permission_status(
|
|
3945
|
+
lambda: _rest_to_client_exceptions(
|
|
3946
|
+
lambda: rest_client.extractor_api.unshare_extractor_for_all(
|
|
3947
|
+
extractor_id=extractor_id,
|
|
3948
|
+
_headers=header,
|
|
3949
|
+
)
|
|
3950
|
+
)
|
|
3951
|
+
)
|
|
3952
|
+
return result
|
|
3953
|
+
|
|
3954
|
+
def share_extractor_with_group(
|
|
3955
|
+
self, extractor_id: str, permission: GroupSharePermission
|
|
3956
|
+
) -> ShareResponseStatus:
|
|
3957
|
+
"""Share an extractor to a group.
|
|
3958
|
+
|
|
3959
|
+
The permission attribute defines which group can access the extractor,
|
|
3960
|
+
the extractor_id attribute denotes the extractor to be shared.
|
|
3961
|
+
|
|
3962
|
+
Args:
|
|
3963
|
+
extractor_id:
|
|
3964
|
+
ID of the extractor to share.
|
|
3965
|
+
permission:
|
|
3966
|
+
Defines the group for sharing with.
|
|
3967
|
+
|
|
3968
|
+
Returns:
|
|
3969
|
+
ShareResponseStatus: Status of share request.
|
|
3970
|
+
"""
|
|
3971
|
+
header = self._get_auth_header()
|
|
3972
|
+
with self._RESTClient(self) as rest_client:
|
|
3973
|
+
result = _get_share_permission_status(
|
|
3974
|
+
lambda: _rest_to_client_exceptions(
|
|
3975
|
+
lambda: rest_client.extractor_api.share_extractor_with_group(
|
|
3976
|
+
extractor_id=extractor_id,
|
|
3977
|
+
group_id=permission.group_id,
|
|
3978
|
+
_headers=header,
|
|
3979
|
+
)
|
|
3980
|
+
)
|
|
3981
|
+
)
|
|
3982
|
+
return result
|
|
3983
|
+
|
|
3984
|
+
def unshare_extractor_from_group(
|
|
3985
|
+
self, extractor_id: str, permission: GroupSharePermission
|
|
3986
|
+
) -> ShareResponseStatus:
|
|
3987
|
+
"""Remove sharing of an extractor from a group.
|
|
3988
|
+
|
|
3989
|
+
The permission attribute defines which group to remove access from,
|
|
3990
|
+
the extractor_id attribute denotes the extractor to be unshared.
|
|
3991
|
+
|
|
3992
|
+
|
|
3993
|
+
Args:
|
|
3994
|
+
extractor_id:
|
|
3995
|
+
ID of the extractor to un-share.
|
|
3996
|
+
permission:
|
|
3997
|
+
Defines the group for which extractor access is revoked.
|
|
3998
|
+
|
|
3999
|
+
Returns:
|
|
4000
|
+
ShareResponseStatus: Status of share request.
|
|
4001
|
+
"""
|
|
4002
|
+
header = self._get_auth_header()
|
|
4003
|
+
with self._RESTClient(self) as rest_client:
|
|
4004
|
+
result = _get_share_permission_status(
|
|
4005
|
+
lambda: _rest_to_client_exceptions(
|
|
4006
|
+
lambda: rest_client.extractor_api.unshare_extractor_from_group(
|
|
4007
|
+
extractor_id=extractor_id,
|
|
4008
|
+
group_id=permission.group_id,
|
|
4009
|
+
_headers=header,
|
|
4010
|
+
)
|
|
4011
|
+
)
|
|
4012
|
+
)
|
|
4013
|
+
return result
|
|
4014
|
+
|
|
4015
|
+
def reset_and_share_extractor_with_groups(
|
|
4016
|
+
self, extractor_id: str, new_groups: List[str]
|
|
4017
|
+
) -> ShareResponseStatus:
|
|
4018
|
+
"""Remove all groups who have access to an extractor and share it with the provided list of new group ids.
|
|
4019
|
+
|
|
4020
|
+
Args:
|
|
4021
|
+
extractor_id:
|
|
4022
|
+
ID of the extractor to un-share.
|
|
4023
|
+
new_groups:
|
|
4024
|
+
The list of group ids this extractor will be shared with.
|
|
4025
|
+
|
|
4026
|
+
ShareResponseStatus: Status of share request.
|
|
4027
|
+
"""
|
|
4028
|
+
header = self._get_auth_header()
|
|
4029
|
+
with self._RESTClient(self) as rest_client:
|
|
4030
|
+
result = _get_share_permission_status(
|
|
4031
|
+
lambda: _rest_to_client_exceptions(
|
|
4032
|
+
lambda: rest_client.extractor_api.reset_and_share_extractor_with_groups(
|
|
4033
|
+
extractor_id=extractor_id,
|
|
4034
|
+
reset_and_share_with_groups_request=rest.ResetAndShareWithGroupsRequest(
|
|
4035
|
+
groups=new_groups,
|
|
4036
|
+
),
|
|
4037
|
+
_headers=header,
|
|
4038
|
+
)
|
|
4039
|
+
)
|
|
4040
|
+
)
|
|
4041
|
+
return result
|
|
4042
|
+
|
|
4043
|
+
def make_extractor_public(self, extractor_id: str):
|
|
4044
|
+
"""Make an extractor public
|
|
4045
|
+
|
|
4046
|
+
Once an extractor is public, it can be seen and used by all users.
|
|
4047
|
+
|
|
4048
|
+
Args:
|
|
4049
|
+
extractor_id:
|
|
4050
|
+
ID of the extractor to make public.
|
|
4051
|
+
"""
|
|
4052
|
+
header = self._get_auth_header()
|
|
4053
|
+
with self._RESTClient(self) as rest_client:
|
|
4054
|
+
_rest_to_client_exceptions(
|
|
4055
|
+
lambda: rest_client.extractor_api.update_extractor_privacy(
|
|
4056
|
+
extractor_id=extractor_id,
|
|
4057
|
+
update_extractor_privacy_request=rest.UpdateExtractorPrivacyRequest(
|
|
4058
|
+
is_public=True
|
|
4059
|
+
),
|
|
4060
|
+
_headers=header,
|
|
4061
|
+
)
|
|
4062
|
+
)
|
|
4063
|
+
|
|
4064
|
+
def make_extractor_private(self, extractor_id: str):
|
|
4065
|
+
"""Make an extractor private
|
|
4066
|
+
|
|
4067
|
+
Once a extractor is private, other users will no longer
|
|
4068
|
+
be able to see or use it unless it has been shared individually or by group.
|
|
4069
|
+
|
|
4070
|
+
Args:
|
|
4071
|
+
extractore_id:
|
|
4072
|
+
ID of the extractor to make private.
|
|
4073
|
+
"""
|
|
4074
|
+
header = self._get_auth_header()
|
|
4075
|
+
with self._RESTClient(self) as rest_client:
|
|
4076
|
+
_rest_to_client_exceptions(
|
|
4077
|
+
lambda: rest_client.extractor_api.update_extractor_privacy(
|
|
4078
|
+
extractor_id=extractor_id,
|
|
4079
|
+
update_extractor_privacy_request=rest.UpdateExtractorPrivacyRequest(
|
|
4080
|
+
is_public=False
|
|
4081
|
+
),
|
|
4082
|
+
_headers=header,
|
|
4083
|
+
)
|
|
4084
|
+
)
|
|
4085
|
+
|
|
3726
4086
|
def list_recent_documents(
|
|
3727
4087
|
self, offset: int, limit: int, metadata_filter: dict = {}
|
|
3728
4088
|
) -> List[DocumentInfo]:
|
|
@@ -4149,6 +4509,29 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
4149
4509
|
)
|
|
4150
4510
|
return collection_id
|
|
4151
4511
|
|
|
4512
|
+
def update_collection_workspace(self, collection_id: str, workspace: str) -> str:
|
|
4513
|
+
"""Update the workspace associated with a collection.
|
|
4514
|
+
|
|
4515
|
+
Args:
|
|
4516
|
+
collection_id:
|
|
4517
|
+
ID of the collection to update.
|
|
4518
|
+
workspace:
|
|
4519
|
+
The workspace associated with the collection.
|
|
4520
|
+
"""
|
|
4521
|
+
|
|
4522
|
+
header = self._get_auth_header()
|
|
4523
|
+
with self._RESTClient(self) as rest_client:
|
|
4524
|
+
_rest_to_client_exceptions(
|
|
4525
|
+
lambda: rest_client.collection_api.update_collection_workspace(
|
|
4526
|
+
collection_id=collection_id,
|
|
4527
|
+
update_collection_workspace_request=rest.UpdateCollectionWorkspaceRequest(
|
|
4528
|
+
workspace=workspace
|
|
4529
|
+
),
|
|
4530
|
+
_headers=header,
|
|
4531
|
+
)
|
|
4532
|
+
)
|
|
4533
|
+
return collection_id
|
|
4534
|
+
|
|
4152
4535
|
def update_document_name(self, document_id: str, name: str) -> str:
|
|
4153
4536
|
"""Update the name metadata for a given document.
|
|
4154
4537
|
|
|
@@ -5008,7 +5391,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5008
5391
|
lambda: _rest_to_client_exceptions(
|
|
5009
5392
|
lambda: rest_client.prompt_template_api.reset_and_share_prompt_template_with_groups(
|
|
5010
5393
|
prompt_template_id=prompt_id,
|
|
5011
|
-
|
|
5394
|
+
reset_and_share_with_groups_request=rest.ResetAndShareWithGroupsRequest(
|
|
5012
5395
|
groups=new_groups,
|
|
5013
5396
|
),
|
|
5014
5397
|
_headers=header,
|
|
@@ -5056,7 +5439,7 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5056
5439
|
lambda: _rest_to_client_exceptions(
|
|
5057
5440
|
lambda: rest_client.prompt_template_api.reset_and_share_prompt_template(
|
|
5058
5441
|
prompt_template_id=prompt_id,
|
|
5059
|
-
|
|
5442
|
+
reset_and_share_request=rest.ResetAndShareRequest(
|
|
5060
5443
|
usernames=new_usernames,
|
|
5061
5444
|
),
|
|
5062
5445
|
_headers=header,
|
|
@@ -5329,6 +5712,27 @@ class H2OGPTE(H2OGPTESyncBase):
|
|
|
5329
5712
|
|
|
5330
5713
|
return self.get_prompt_template(rest_session.prompt_template_id)
|
|
5331
5714
|
|
|
5715
|
+
def get_chat_session_workspace(self, chat_session_id: str) -> str:
|
|
5716
|
+
"""Get the workspace associated with the chat session.
|
|
5717
|
+
|
|
5718
|
+
Args:
|
|
5719
|
+
chat_session_id:
|
|
5720
|
+
String id of the chat session to search for.
|
|
5721
|
+
|
|
5722
|
+
Returns:
|
|
5723
|
+
str: The identifier of the workspace
|
|
5724
|
+
"""
|
|
5725
|
+
header = self._get_auth_header()
|
|
5726
|
+
with self._RESTClient(self) as rest_client:
|
|
5727
|
+
response = _rest_to_client_exceptions(
|
|
5728
|
+
lambda: rest_client.chat_api.get_chat_session(
|
|
5729
|
+
session_id=chat_session_id,
|
|
5730
|
+
_headers=header,
|
|
5731
|
+
)
|
|
5732
|
+
)
|
|
5733
|
+
|
|
5734
|
+
return response.workspace
|
|
5735
|
+
|
|
5332
5736
|
def set_chat_session_collection(
|
|
5333
5737
|
self, chat_session_id: str, collection_id: Union[str, None]
|
|
5334
5738
|
) -> str:
|