kensho-kfinance 2.2.4__py3-none-any.whl → 2.3.0__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-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/METADATA +14 -4
- {kensho_kfinance-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/RECORD +22 -16
- kfinance/CHANGELOG.md +9 -0
- kfinance/fetch.py +26 -10
- kfinance/kfinance.py +227 -11
- kfinance/meta_classes.py +26 -8
- kfinance/pydantic_models.py +33 -0
- kfinance/tests/test_example_notebook.py +4 -2
- kfinance/tests/test_fetch.py +74 -1
- kfinance/tests/test_objects.py +165 -2
- kfinance/tests/test_tools.py +217 -1
- kfinance/tool_calling/__init__.py +8 -0
- kfinance/tool_calling/get_earnings.py +30 -0
- kfinance/tool_calling/get_latest_earnings.py +27 -0
- kfinance/tool_calling/get_next_earnings.py +27 -0
- kfinance/tool_calling/get_transcript.py +23 -0
- kfinance/tool_calling/prompts.py +16 -0
- kfinance/version.py +2 -2
- {kensho_kfinance-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/WHEEL +0 -0
- {kensho_kfinance-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/licenses/AUTHORS.md +0 -0
- {kensho_kfinance-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/licenses/LICENSE +0 -0
- {kensho_kfinance-2.2.4.dist-info → kensho_kfinance-2.3.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Type
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from kfinance.constants import Permission
|
|
6
|
+
from kfinance.tool_calling.shared_models import KfinanceTool
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GetTranscriptArgs(BaseModel):
|
|
10
|
+
"""Tool argument with a key_dev_id."""
|
|
11
|
+
|
|
12
|
+
key_dev_id: int = Field(description="The key dev ID for the earnings call")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class GetTranscript(KfinanceTool):
|
|
16
|
+
name: str = "get_transcript"
|
|
17
|
+
description: str = "Get the raw transcript text for an earnings call by key dev ID."
|
|
18
|
+
args_schema: Type[BaseModel] = GetTranscriptArgs
|
|
19
|
+
required_permission: Permission | None = Permission.EarningsPermission
|
|
20
|
+
|
|
21
|
+
def _run(self, key_dev_id: int) -> str:
|
|
22
|
+
transcript = self.kfinance_client.transcript(key_dev_id)
|
|
23
|
+
return transcript.raw
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from kfinance.tool_calling import GetFinancialLineItemFromIdentifier, GetLatest
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
BASE_PROMPT = f"""
|
|
5
|
+
You are an agent that calls one or more tools to retrieve data to answer questions from
|
|
6
|
+
financial analysts. Use the supplied tools to answer the user's questions.
|
|
7
|
+
|
|
8
|
+
- Always use the `{GetLatest.model_fields["name"].default}` function when asked about the last or most recent quarter or
|
|
9
|
+
when the time is unspecified in the question.
|
|
10
|
+
- Try to use `{GetFinancialLineItemFromIdentifier.model_fields["name"].default}` for questions about a company's
|
|
11
|
+
finances.
|
|
12
|
+
- If the tools do not respond with data that answers the question, then respond by saying that
|
|
13
|
+
you don't have the data available.
|
|
14
|
+
- Keep calling tools until you have the answer or the tool says the data is not available.
|
|
15
|
+
- Label large numbers with "million" or "billion" and currency symbols if appropriate.
|
|
16
|
+
"""
|
kfinance/version.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|