kensho-kfinance 3.2.8__py3-none-any.whl → 3.2.10__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.
Potentially problematic release.
This version of kensho-kfinance might be problematic. Click here for more details.
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/METADATA +1 -1
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/RECORD +14 -14
- kfinance/CHANGELOG.md +6 -1
- kfinance/domains/companies/company_tools.py +12 -3
- kfinance/domains/companies/tests/test_company_tools.py +7 -1
- kfinance/domains/line_items/line_item_tools.py +1 -0
- kfinance/domains/segments/segment_tools.py +6 -1
- kfinance/domains/statements/statement_tools.py +1 -0
- kfinance/integrations/tool_calling/tests/test_tool_calling_models.py +7 -2
- kfinance/version.py +2 -2
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/WHEEL +0 -0
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/licenses/AUTHORS.md +0 -0
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/licenses/LICENSE +0 -0
- {kensho_kfinance-3.2.8.dist-info → kensho_kfinance-3.2.10.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kensho-kfinance
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.10
|
|
4
4
|
Summary: Python CLI for kFinance
|
|
5
5
|
Author-email: Luke Brown <luke.brown@kensho.com>, Michelle Keoy <michelle.keoy@kensho.com>, Keith Page <keith.page@kensho.com>, Matthew Rosen <matthew.rosen@kensho.com>, Nick Roshdieh <nick.roshdieh@kensho.com>
|
|
6
6
|
Project-URL: source, https://github.com/kensho-technologies/kfinance
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
kensho_kfinance-3.2.
|
|
2
|
-
kensho_kfinance-3.2.
|
|
3
|
-
kfinance/CHANGELOG.md,sha256=
|
|
1
|
+
kensho_kfinance-3.2.10.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
|
|
2
|
+
kensho_kfinance-3.2.10.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
|
|
3
|
+
kfinance/CHANGELOG.md,sha256=3mgDixfg0ojmEr3D36QnfaFd8YZD5zeHkjA3NHBRm08,3388
|
|
4
4
|
kfinance/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
5
|
kfinance/conftest.py,sha256=FIZNQyfFbldyVmzaLfWbnMGh6RiC4MZwOVax6815_Ms,3754
|
|
6
6
|
kfinance/mcp.py,sha256=LTzCIlqsDKRD-0Xcpa_P99-JmJ8duAneO_-GzM43kjw,424
|
|
7
7
|
kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
kfinance/version.py,sha256=
|
|
8
|
+
kfinance/version.py,sha256=0Do_CqGpGkuLSWuqbzGC46drHfwvUEjSDoKQNrc0rss,706
|
|
9
9
|
kfinance/client/README.md,sha256=DA5vg4uz1JmJNiqvYywrj46YNhOr584WO8L83Ysx_Mk,372
|
|
10
10
|
kfinance/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
kfinance/client/batch_request_handling.py,sha256=opwJJAU2JtqH-s4vt8wRqhH34MiU4tQP6Ng7K6b3upA,6561
|
|
@@ -43,9 +43,9 @@ kfinance/domains/capitalizations/tests/test_capitalization_tools.py,sha256=H43ml
|
|
|
43
43
|
kfinance/domains/companies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
kfinance/domains/companies/company_identifiers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
kfinance/domains/companies/company_models.py,sha256=Ny0o5lB5e1gN3bSj8bVbfqg6ktgJrwn9-58sKO1bmXs,5060
|
|
46
|
-
kfinance/domains/companies/company_tools.py,sha256=
|
|
46
|
+
kfinance/domains/companies/company_tools.py,sha256=PGBKlOUGCCK6eqUK9EbiSznBDnbu2YhgMwnqu5WkoJo,9171
|
|
47
47
|
kfinance/domains/companies/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
kfinance/domains/companies/tests/test_company_tools.py,sha256=
|
|
48
|
+
kfinance/domains/companies/tests/test_company_tools.py,sha256=ijZF6tWswvtD9YpjtGAPsS76nyOf6aaNPB_u_v-EAwQ,5587
|
|
49
49
|
kfinance/domains/competitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
50
|
kfinance/domains/competitors/competitor_models.py,sha256=HAEn2AzKZNusclsFzyAufpS-627RfRGL4Vw1AiT_Ek0,747
|
|
51
51
|
kfinance/domains/competitors/competitor_tools.py,sha256=k1zyr03gbnIrQ8IaENaZlVE8RiiW_77MqnArWzKa02M,2524
|
|
@@ -62,7 +62,7 @@ kfinance/domains/earnings/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
|
62
62
|
kfinance/domains/earnings/tests/test_earnings_tools.py,sha256=qGhdWI1s4uEjF6XtFC0f1nlAths1H6xfym-iJyBpwBo,6998
|
|
63
63
|
kfinance/domains/line_items/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
64
|
kfinance/domains/line_items/line_item_models.py,sha256=6J_9cko9nZ3OAGSC7OMGEMQW8dkXjRLWn4_2BjtHemU,50969
|
|
65
|
-
kfinance/domains/line_items/line_item_tools.py,sha256=
|
|
65
|
+
kfinance/domains/line_items/line_item_tools.py,sha256=lxvhYbnZKapIf2nIfdtVqXiDswJoeU5XxMOAGUeb8cI,5192
|
|
66
66
|
kfinance/domains/line_items/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
67
67
|
kfinance/domains/line_items/tests/test_line_item_tools.py,sha256=vgxJsPbQG1msXZKTfpyHSzUfhw0GvfxZ041T7J-56hU,5499
|
|
68
68
|
kfinance/domains/mergers_and_acquisitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -78,12 +78,12 @@ kfinance/domains/prices/tests/test_price_models.py,sha256=PWGqbR9aCys2ldHZMF5anM
|
|
|
78
78
|
kfinance/domains/prices/tests/test_price_tools.py,sha256=xNuzAzeu1KuhkB0xF2oIYLVZub9uDg8VLRNmKq-iJ3s,6426
|
|
79
79
|
kfinance/domains/segments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
80
|
kfinance/domains/segments/segment_models.py,sha256=CEZK_B9WM0eppsOpjUbt-ILIcLkQMYgVq4TAx_SrPlc,262
|
|
81
|
-
kfinance/domains/segments/segment_tools.py,sha256=
|
|
81
|
+
kfinance/domains/segments/segment_tools.py,sha256=3zOAn0tayBykTNiprwn32hH-Q0sNJrPwMhnoGSs6yYo,4654
|
|
82
82
|
kfinance/domains/segments/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
83
|
kfinance/domains/segments/tests/test_segment_tools.py,sha256=Qmh1SpGwVGUhe_r1b4ZpBesu_yN2hq2wiM3z1wmmY6M,4975
|
|
84
84
|
kfinance/domains/statements/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
85
|
kfinance/domains/statements/statement_models.py,sha256=f7jEejuvMbsW9paqHIJ19DKUX3XL_qzf74jZBKDamfE,328
|
|
86
|
-
kfinance/domains/statements/statement_tools.py,sha256=
|
|
86
|
+
kfinance/domains/statements/statement_tools.py,sha256=RHNQmv4yExXHHxokwgxzLuYG9iCfZuOKRRThm-K3mOQ,5162
|
|
87
87
|
kfinance/domains/statements/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
88
|
kfinance/domains/statements/tests/test_statement_tools.py,sha256=mraxvm6tpd-SFRIcco9dKRR2VC8kg1LlYcggBBocLBA,6052
|
|
89
89
|
kfinance/integrations/README.md,sha256=GalSN11UHzbLfcNzKAlObNbw5XqMKVXSVzzGlryM3zc,320
|
|
@@ -106,9 +106,9 @@ kfinance/integrations/tool_calling/static_tools/tests/__init__.py,sha256=47DEQpj
|
|
|
106
106
|
kfinance/integrations/tool_calling/static_tools/tests/test_get_lastest.py,sha256=MN2gx-Hhvfvwh9v6eL_d5Yrbb054q7How1tPdYQlPvg,1149
|
|
107
107
|
kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py,sha256=BjlTgaNrI5Tv7SpTWz0Q8WucDLcQviCqVH2zgLpNpcM,856
|
|
108
108
|
kfinance/integrations/tool_calling/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
109
|
-
kfinance/integrations/tool_calling/tests/test_tool_calling_models.py,sha256=
|
|
109
|
+
kfinance/integrations/tool_calling/tests/test_tool_calling_models.py,sha256=5L8TpSVJmrjNzGcnERorpfeyrgLND_DL46ld5hVlcNw,2933
|
|
110
110
|
kfinance/models/permission_models.py,sha256=G0so8ZOsD1YDsCM4he0z5R9M_shUbSRwD3hUDJdqZl0,635
|
|
111
|
-
kensho_kfinance-3.2.
|
|
112
|
-
kensho_kfinance-3.2.
|
|
113
|
-
kensho_kfinance-3.2.
|
|
114
|
-
kensho_kfinance-3.2.
|
|
111
|
+
kensho_kfinance-3.2.10.dist-info/METADATA,sha256=u2l7KD1wRwk071OyjYEXqr3N6ZgcvZNRPZQG0OjAqkg,6198
|
|
112
|
+
kensho_kfinance-3.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
113
|
+
kensho_kfinance-3.2.10.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
|
|
114
|
+
kensho_kfinance-3.2.10.dist-info/RECORD,,
|
kfinance/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
# 3.2.10
|
|
3
|
+
- Add CIQ company_id to GetInfoFromIdentifiersResp
|
|
4
|
+
|
|
5
|
+
# v3.2.9
|
|
6
|
+
- Update tool descriptions for line items, segments, and statements to mention that all period-based inputs and outputs refer only to the calendar year.
|
|
2
7
|
|
|
3
8
|
# v3.2.8
|
|
4
|
-
-
|
|
9
|
+
- Add support for None to LineItemResponse & empty behavior for line items, segments, and statements
|
|
5
10
|
|
|
6
11
|
# v3.2.7
|
|
7
12
|
- Fix validator for UnifiedIdTripleResponse
|
|
@@ -5,7 +5,11 @@ from pydantic import BaseModel
|
|
|
5
5
|
|
|
6
6
|
from kfinance.client.batch_request_handling import Task, process_tasks_in_thread_pool_executor
|
|
7
7
|
from kfinance.client.permission_models import Permission
|
|
8
|
-
from kfinance.domains.companies.company_models import
|
|
8
|
+
from kfinance.domains.companies.company_models import (
|
|
9
|
+
COMPANY_ID_PREFIX,
|
|
10
|
+
CompanyDescriptions,
|
|
11
|
+
CompanyOtherNames,
|
|
12
|
+
)
|
|
9
13
|
from kfinance.integrations.tool_calling.tool_calling_models import (
|
|
10
14
|
KfinanceTool,
|
|
11
15
|
ToolArgsWithIdentifiers,
|
|
@@ -20,7 +24,7 @@ class GetInfoFromIdentifiersResp(ToolRespWithErrors):
|
|
|
20
24
|
class GetInfoFromIdentifiers(KfinanceTool):
|
|
21
25
|
name: str = "get_info_from_identifiers"
|
|
22
26
|
description: str = dedent("""
|
|
23
|
-
Get the information associated with a list of identifiers. Info includes company name, status, type, simple industry, number of employees (if available), founding date, webpage, HQ address, HQ city, HQ zip code, HQ state, HQ country,
|
|
27
|
+
Get the information associated with a list of identifiers. Info includes company name, status, type, simple industry, number of employees (if available), founding date, webpage, HQ address, HQ city, HQ zip code, HQ state, HQ country, HQ country iso code, and CIQ company_id.
|
|
24
28
|
|
|
25
29
|
- When possible, pass multiple identifiers in a single call rather than making multiple calls.
|
|
26
30
|
""").strip()
|
|
@@ -44,7 +48,8 @@ class GetInfoFromIdentifiers(KfinanceTool):
|
|
|
44
48
|
"zip_code": "10041-0001",
|
|
45
49
|
"state": "New York",
|
|
46
50
|
"country": "United States",
|
|
47
|
-
"iso_country": "USA"
|
|
51
|
+
"iso_country": "USA",
|
|
52
|
+
"company_id": "C_21719"
|
|
48
53
|
}
|
|
49
54
|
},
|
|
50
55
|
"errors": [['No identification triple found for the provided identifier: NON-EXISTENT of type: ticker']
|
|
@@ -65,6 +70,10 @@ class GetInfoFromIdentifiers(KfinanceTool):
|
|
|
65
70
|
info_responses: dict[str, dict] = process_tasks_in_thread_pool_executor(
|
|
66
71
|
api_client=api_client, tasks=tasks
|
|
67
72
|
)
|
|
73
|
+
|
|
74
|
+
for identifier, id_triple in id_triple_resp.identifiers_to_id_triples.items():
|
|
75
|
+
info_responses[identifier]["company_id"] = f"{COMPANY_ID_PREFIX}{id_triple.company_id}"
|
|
76
|
+
|
|
68
77
|
return GetInfoFromIdentifiersResp(
|
|
69
78
|
results=info_responses, errors=list(id_triple_resp.errors.values())
|
|
70
79
|
)
|
|
@@ -2,6 +2,7 @@ from requests_mock import Mocker
|
|
|
2
2
|
|
|
3
3
|
from kfinance.client.kfinance import Client
|
|
4
4
|
from kfinance.conftest import SPGI_COMPANY_ID
|
|
5
|
+
from kfinance.domains.companies.company_models import COMPANY_ID_PREFIX
|
|
5
6
|
from kfinance.domains.companies.company_tools import (
|
|
6
7
|
GetCompanyDescriptionFromIdentifiers,
|
|
7
8
|
GetCompanyDescriptionFromIdentifiersResp,
|
|
@@ -23,7 +24,11 @@ class TestGetInfoFromIdentifiers:
|
|
|
23
24
|
THEN we get back info for SPGI and an error for the non-existent company
|
|
24
25
|
"""
|
|
25
26
|
|
|
26
|
-
info_resp = {
|
|
27
|
+
info_resp = {
|
|
28
|
+
"name": "S&P Global Inc.",
|
|
29
|
+
"status": "Operating",
|
|
30
|
+
"company_id": f"{COMPANY_ID_PREFIX}{SPGI_COMPANY_ID}",
|
|
31
|
+
}
|
|
27
32
|
expected_response = GetInfoFromIdentifiersResp.model_validate(
|
|
28
33
|
{
|
|
29
34
|
"results": {"SPGI": info_resp},
|
|
@@ -32,6 +37,7 @@ class TestGetInfoFromIdentifiers:
|
|
|
32
37
|
],
|
|
33
38
|
}
|
|
34
39
|
)
|
|
40
|
+
del info_resp["company_id"]
|
|
35
41
|
requests_mock.get(
|
|
36
42
|
url=f"https://kfinance.kensho.com/api/v1/info/{SPGI_COMPANY_ID}",
|
|
37
43
|
json=info_resp,
|
|
@@ -43,6 +43,7 @@ class GetFinancialLineItemFromIdentifiers(KfinanceTool):
|
|
|
43
43
|
|
|
44
44
|
- When possible, pass multiple identifiers in a single call rather than making multiple calls.
|
|
45
45
|
- To fetch the most recent value for the line item, leave start_year, start_quarter, end_year, and end_quarter as None.
|
|
46
|
+
- The tool accepts arguments in calendar years, and all outputs will be presented in terms of calendar years. Please note that these calendar years may not align with the company's fiscal year.
|
|
46
47
|
|
|
47
48
|
Example:
|
|
48
49
|
Query: "What are the revenues of Lowe's and Home Depot?"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from textwrap import dedent
|
|
1
2
|
from typing import Literal, Type
|
|
2
3
|
|
|
3
4
|
from pydantic import BaseModel, Field
|
|
@@ -30,7 +31,11 @@ class GetSegmentsFromIdentifiersResp(ToolRespWithErrors):
|
|
|
30
31
|
|
|
31
32
|
class GetSegmentsFromIdentifiers(KfinanceTool):
|
|
32
33
|
name: str = "get_segments_from_identifiers"
|
|
33
|
-
description: str = "
|
|
34
|
+
description: str = dedent("""
|
|
35
|
+
Get the templated segments associated with a list of identifiers.
|
|
36
|
+
|
|
37
|
+
- The tool accepts arguments in calendar years, and all outputs will be presented in terms of calendar years. Please note that these calendar years may not align with the company's fiscal year.
|
|
38
|
+
""").strip()
|
|
34
39
|
args_schema: Type[BaseModel] = GetSegmentsFromIdentifiersArgs
|
|
35
40
|
accepted_permissions: set[Permission] | None = {Permission.SegmentsPermission}
|
|
36
41
|
|
|
@@ -35,6 +35,7 @@ class GetFinancialStatementFromIdentifiers(KfinanceTool):
|
|
|
35
35
|
Get a financial statement associated with a group of identifiers.
|
|
36
36
|
|
|
37
37
|
- To fetch the most recent value for the statement, leave start_year, start_quarter, end_year, and end_quarter as None.
|
|
38
|
+
- The tool accepts arguments in calendar years, and all outputs will be presented in terms of calendar years. Please note that these calendar years may not align with the company's fiscal year.
|
|
38
39
|
|
|
39
40
|
Example:
|
|
40
41
|
Query: "Fetch the balance sheets of BAC and GS for 2024"
|
|
@@ -7,6 +7,7 @@ from requests_mock import Mocker
|
|
|
7
7
|
|
|
8
8
|
from kfinance.client.kfinance import Client
|
|
9
9
|
from kfinance.conftest import SPGI_COMPANY_ID
|
|
10
|
+
from kfinance.domains.companies.company_models import COMPANY_ID_PREFIX
|
|
10
11
|
from kfinance.domains.companies.company_tools import (
|
|
11
12
|
GetInfoFromIdentifiers,
|
|
12
13
|
GetInfoFromIdentifiersResp,
|
|
@@ -25,7 +26,11 @@ class TestGetEndpointsFromToolCallsWithGrounding:
|
|
|
25
26
|
"""
|
|
26
27
|
|
|
27
28
|
# truncated from the original
|
|
28
|
-
resp_data = {
|
|
29
|
+
resp_data = {
|
|
30
|
+
"name": "S&P Global Inc.",
|
|
31
|
+
"status": "Operating",
|
|
32
|
+
"company_id": f"{COMPANY_ID_PREFIX}{SPGI_COMPANY_ID}",
|
|
33
|
+
}
|
|
29
34
|
resp_endpoint = [
|
|
30
35
|
"https://kfinance.kensho.com/api/v1/ids",
|
|
31
36
|
"https://kfinance.kensho.com/api/v1/info/21719",
|
|
@@ -34,7 +39,7 @@ class TestGetEndpointsFromToolCallsWithGrounding:
|
|
|
34
39
|
"data": GetInfoFromIdentifiersResp.model_validate({"results": {"SPGI": resp_data}}),
|
|
35
40
|
"endpoint_urls": resp_endpoint,
|
|
36
41
|
}
|
|
37
|
-
|
|
42
|
+
del resp_data["company_id"]
|
|
38
43
|
requests_mock.get(
|
|
39
44
|
url=f"https://kfinance.kensho.com/api/v1/info/{SPGI_COMPANY_ID}",
|
|
40
45
|
json=resp_data,
|
kfinance/version.py
CHANGED
|
@@ -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 = '3.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (3, 2,
|
|
31
|
+
__version__ = version = '3.2.10'
|
|
32
|
+
__version_tuple__ = version_tuple = (3, 2, 10)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|