langchain-timbr 2.1.3__tar.gz → 2.1.4__tar.gz
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.
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/PKG-INFO +1 -1
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/_version.py +2 -2
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/execute_timbr_query_chain.py +3 -1
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/generate_answer_chain.py +4 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/generate_timbr_sql_chain.py +1 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/timbr_sql_agent.py +1 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/validate_timbr_sql_chain.py +1 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/timbr_llm_connector.py +1 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/timbr_llm_utils.py +3 -1
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/timbr_utils.py +15 -2
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/dependabot.yml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/pull_request_template.md +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/workflows/_codespell.yml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/workflows/_fossa.yml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/workflows/install-dependencies-and-run-tests.yml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.github/workflows/publish.yml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/.gitignore +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/LICENSE +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/README.md +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/SECURITY.md +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/pyproject.toml +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/pytest.ini +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/requirements.txt +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/requirements310.txt +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/requirements311.txt +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/__init__.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/config.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/__init__.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langchain/identify_concept_chain.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/__init__.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/execute_timbr_query_node.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/generate_response_node.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/generate_timbr_sql_node.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/identify_concept_node.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/langgraph/validate_timbr_query_node.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/llm_wrapper/llm_wrapper.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/llm_wrapper/timbr_llm_wrapper.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/general.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/prompt_service.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/temperature_supported_models.json +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/README.md +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/conftest.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_agent_integration.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_azure_databricks_provider.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_azure_openai_model.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_chain_pipeline.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_jwt_token.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_langchain_chains.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_langgraph_nodes.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_timeout_functionality.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/conftest.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_chain_documentation.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_connection_validation.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_llm_wrapper_optional_params.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_optional_llm_integration.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_standard_chain_requirements.py +0 -0
- {langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_unit_tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-timbr
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.4
|
|
4
4
|
Summary: LangChain & LangGraph extensions that parse LLM prompts into Timbr semantic SQL and execute them.
|
|
5
5
|
Project-URL: Homepage, https://github.com/WPSemantix/langchain-timbr
|
|
6
6
|
Project-URL: Documentation, https://docs.timbr.ai/doc/docs/integration/langchain-sdk/
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '2.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (2, 1,
|
|
31
|
+
__version__ = version = '2.1.4'
|
|
32
|
+
__version_tuple__ = version_tuple = (2, 1, 4)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -169,6 +169,7 @@ class ExecuteTimbrQueryChain(Chain):
|
|
|
169
169
|
"verify_ssl": self._verify_ssl,
|
|
170
170
|
"is_jwt": self._is_jwt,
|
|
171
171
|
"jwt_tenant_id": self._jwt_tenant_id,
|
|
172
|
+
"additional_headers": {"results-limit": str(self._max_limit)},
|
|
172
173
|
**self._conn_params,
|
|
173
174
|
}
|
|
174
175
|
|
|
@@ -265,7 +266,8 @@ class ExecuteTimbrQueryChain(Chain):
|
|
|
265
266
|
rows = run_query(
|
|
266
267
|
sql,
|
|
267
268
|
self._get_conn_params(),
|
|
268
|
-
llm_prompt=prompt
|
|
269
|
+
llm_prompt=prompt,
|
|
270
|
+
use_query_limit=True,
|
|
269
271
|
) if is_sql_valid and is_sql_not_tried else []
|
|
270
272
|
|
|
271
273
|
if iteration < self._no_results_max_retries:
|
|
@@ -23,6 +23,7 @@ class GenerateAnswerChain(Chain):
|
|
|
23
23
|
is_jwt: Optional[bool] = False,
|
|
24
24
|
jwt_tenant_id: Optional[str] = None,
|
|
25
25
|
conn_params: Optional[dict] = None,
|
|
26
|
+
note: Optional[str] = '',
|
|
26
27
|
debug: Optional[bool] = False,
|
|
27
28
|
**kwargs,
|
|
28
29
|
):
|
|
@@ -33,6 +34,7 @@ class GenerateAnswerChain(Chain):
|
|
|
33
34
|
:param verify_ssl: Whether to verify SSL certificates (default is True).
|
|
34
35
|
:param is_jwt: Whether to use JWT authentication (default is False).
|
|
35
36
|
:param jwt_tenant_id: JWT tenant ID for multi-tenant environments (required when is_jwt=True).
|
|
37
|
+
:param note: Optional additional note to extend our llm prompt
|
|
36
38
|
:param conn_params: Extra Timbr connection parameters sent with every request (e.g., 'x-api-impersonate-user').
|
|
37
39
|
|
|
38
40
|
## Example
|
|
@@ -77,6 +79,7 @@ class GenerateAnswerChain(Chain):
|
|
|
77
79
|
self._jwt_tenant_id = jwt_tenant_id
|
|
78
80
|
self._debug = to_boolean(debug)
|
|
79
81
|
self._conn_params = conn_params or {}
|
|
82
|
+
self._note = note
|
|
80
83
|
|
|
81
84
|
|
|
82
85
|
@property
|
|
@@ -116,6 +119,7 @@ class GenerateAnswerChain(Chain):
|
|
|
116
119
|
conn_params=self._get_conn_params(),
|
|
117
120
|
results=rows,
|
|
118
121
|
sql=sql,
|
|
122
|
+
note=self._note,
|
|
119
123
|
debug=self._debug,
|
|
120
124
|
)
|
|
121
125
|
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/utils/timbr_llm_utils.py
RENAMED
|
@@ -545,8 +545,9 @@ def answer_question(
|
|
|
545
545
|
conn_params: dict,
|
|
546
546
|
results: str,
|
|
547
547
|
sql: Optional[str] = None,
|
|
548
|
-
debug: Optional[bool] = False,
|
|
549
548
|
timeout: Optional[int] = None,
|
|
549
|
+
note: Optional[str] = '',
|
|
550
|
+
debug: Optional[bool] = False,
|
|
550
551
|
) -> dict[str, Any]:
|
|
551
552
|
# Use config default timeout if none provided
|
|
552
553
|
if timeout is None:
|
|
@@ -558,6 +559,7 @@ def answer_question(
|
|
|
558
559
|
question=question,
|
|
559
560
|
formatted_rows=results,
|
|
560
561
|
additional_context=f"SQL QUERY:\n{sql}\n\n" if sql else "",
|
|
562
|
+
note=note,
|
|
561
563
|
)
|
|
562
564
|
|
|
563
565
|
apx_token_count = _calculate_token_count(llm, prompt)
|
|
@@ -70,7 +70,7 @@ def cache_with_version_check(func):
|
|
|
70
70
|
return wrapper
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
def run_query(sql: str, conn_params: dict, llm_prompt: Optional[str] = None) -> list[list]:
|
|
73
|
+
def run_query(sql: str, conn_params: dict, llm_prompt: Optional[str] = None, use_query_limit = False) -> list[list]:
|
|
74
74
|
if not conn_params:
|
|
75
75
|
raise("Please provide connection params.")
|
|
76
76
|
|
|
@@ -79,9 +79,22 @@ def run_query(sql: str, conn_params: dict, llm_prompt: Optional[str] = None) ->
|
|
|
79
79
|
clean_prompt = llm_prompt.replace('\r\n', ' ').replace('\n', ' ').replace('?', '')
|
|
80
80
|
query = f"-- LLM: {clean_prompt}\n{sql}"
|
|
81
81
|
|
|
82
|
+
query_conn_params = conn_params
|
|
83
|
+
if not use_query_limit:
|
|
84
|
+
# Remove results-limit
|
|
85
|
+
if 'additional_headers' in conn_params and 'results-limit' in conn_params['additional_headers']:
|
|
86
|
+
query_upper = query.strip().upper()
|
|
87
|
+
if query_upper.startswith('SHOW') or query_upper.startswith('DESC'):
|
|
88
|
+
query_conn_params = conn_params.copy()
|
|
89
|
+
query_conn_params['additional_headers'] = conn_params['additional_headers'].copy()
|
|
90
|
+
del query_conn_params['additional_headers']['results-limit']
|
|
91
|
+
# If no other additional_headers remain, delete the key entirely
|
|
92
|
+
if not query_conn_params['additional_headers']:
|
|
93
|
+
del query_conn_params['additional_headers']
|
|
94
|
+
|
|
82
95
|
results = timbr_http_connector.run_query(
|
|
83
96
|
query=query,
|
|
84
|
-
**
|
|
97
|
+
**query_conn_params,
|
|
85
98
|
)
|
|
86
99
|
|
|
87
100
|
return results
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/llm_wrapper/llm_wrapper.py
RENAMED
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/src/langchain_timbr/llm_wrapper/timbr_llm_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_azure_databricks_provider.py
RENAMED
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_azure_openai_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/integration/test_timeout_functionality.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_connection_validation.py
RENAMED
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_llm_wrapper_optional_params.py
RENAMED
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_optional_llm_integration.py
RENAMED
|
File without changes
|
{langchain_timbr-2.1.3 → langchain_timbr-2.1.4}/tests/standard/test_standard_chain_requirements.py
RENAMED
|
File without changes
|
|
File without changes
|