LONGYKING commited on
Commit
84ef220
·
1 Parent(s): a36d1ff

increased httpx timeout to 60 secs

Browse files
.chainlit/.langchain.db ADDED
Binary file (32.8 kB). View file
 
.chainlit/config.toml CHANGED
@@ -10,7 +10,7 @@ user_env = []
10
  session_timeout = 3600
11
 
12
  # Enable third parties caching (e.g LangChain cache)
13
- cache = false
14
 
15
  # Authorized origins
16
  allow_origins = ["*"]
@@ -33,7 +33,7 @@ auto_tag_thread = true
33
 
34
  # Authorize users to spontaneously upload files with messages
35
  [features.spontaneous_file_upload]
36
- enabled = true
37
  accept = ["*/*"]
38
  max_files = 20
39
  max_size_mb = 500
 
10
  session_timeout = 3600
11
 
12
  # Enable third parties caching (e.g LangChain cache)
13
+ cache = true
14
 
15
  # Authorized origins
16
  allow_origins = ["*"]
 
33
 
34
  # Authorize users to spontaneously upload files with messages
35
  [features.spontaneous_file_upload]
36
+ enabled = false
37
  accept = ["*/*"]
38
  max_files = 20
39
  max_size_mb = 500
chatxbt-assistant.py CHANGED
@@ -1,20 +1,14 @@
1
- import os, json
2
  from typing import Optional, Dict
3
  from dotenv import load_dotenv
4
-
5
- load_dotenv()
6
-
7
  import chainlit as cl
8
  from phi.assistant import Assistant
9
  from phi.llm.openai import OpenAIChat
10
- from phi.llm.ollama import Ollama
11
- from phi.llm.groq import Groq
12
  from phi.tools.duckduckgo import DuckDuckGo
13
  from phi.tools.yfinance import YFinanceTools
14
  from src.databases.postgres import sqlalchemy_engine
15
  from src.knowledge_bases.combined import knowledge_base
16
  from src.tools.crypto_swap_toolkit import CryptoSwapTools
17
- from src.tools.crypto_bridge_toolkit import CrossChainSwapTools
18
  from src.tools.crypto_data_toolkit import CryptoDataTools
19
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
20
  from src.config.portkey_config import generate_portkey_config
@@ -23,33 +17,28 @@ from phi.storage.assistant.postgres import PgAssistantStorage
23
  from src.tools.crypto_evm_wallet_toolkit import CryptoEVMWalletTools
24
  from src.tools.user_confirmation_pin_toolkit import UserConfirmationPinToolkit
25
 
 
 
26
 
 
27
  storage = PgAssistantStorage(
28
- # stores runs in the ai.assistant_runs table
29
  table_name="assistant_runs",
30
  db_engine=sqlalchemy_engine
31
  )
32
 
 
33
  @cl.oauth_callback
34
- def oauth_callback(
35
- provider_id: str,
36
- token: str,
37
- raw_user_data: Dict[str, str],
38
- default_user: cl.User,
39
- ) -> Optional[cl.User]:
40
- # step-todo: will handle auth from v2 api
41
  return cl.User(
42
  identifier=raw_user_data.get('email'),
43
  email=raw_user_data.get('email'),
44
  name=raw_user_data.get('name'),
45
- metadata={**raw_user_data, **({'image':default_user.metadata.get('image')})}
46
  )
47
 
48
-
49
  @cl.password_auth_callback
50
- def auth_callback(username: str, password: str):
51
- # Fetch the user matching username from your database
52
- # and compare the hashed password with the value stored in the database
53
  if (username, password) == ("admin", "admin"):
54
  user = {
55
  "identifier": "admin", "email": username, "metadata": {"role": "admin", "provider": "credentials"}
@@ -58,10 +47,9 @@ def auth_callback(username: str, password: str):
58
  return cl.User(
59
  identifier="admin", email=username, metadata={"role": "admin", "provider": "credentials"}
60
  )
61
- else:
62
- return None
63
-
64
 
 
65
  @cl.set_starters
66
  async def set_starters():
67
  return [
@@ -70,41 +58,46 @@ async def set_starters():
70
  message="create a crypto wallet for me",
71
  icon="/public/wallet-svgrepo-com.svg",
72
  ),
73
-
74
  cl.Starter(
75
  label="Latest News on defi, crypto and solana",
76
- message="What news are currentlly trending on defi.",
77
  icon="/public/news-svgrepo-com.svg",
78
- ),
79
  cl.Starter(
80
  label="Get price of BTC, ETH and PEPE",
81
- message="Get me the Price of BTC, ETH and PEPE",
82
  icon="/public/coins-electronics-svgrepo-com.svg",
83
- ),
84
  cl.Starter(
85
  label="Get trending stocks",
86
  message="Get latest stock",
87
  icon="/public/stockchart-svgrepo-com.svg",
88
- )
89
- ]
90
 
 
91
  @cl.on_chat_start
92
  async def start():
93
- is_dev_mode = True if os.getenv("DEV_MODE") else False
94
-
95
- portkey_local_gateway = True if os.getenv("PORTKEY_LOCAL_GATEWAY_URL") else False
96
  portkey_config = generate_portkey_config(local=portkey_local_gateway)
97
 
98
  # Initialize the assistant
99
  cxbt_assistant = Assistant(
100
- # llm=OpenAIChat(),
101
- # llm=Groq(model="llama3-70b-8192"),
102
- llm=Ollama(model="llama3"),
 
 
 
 
 
 
 
103
  tools=[
104
  DuckDuckGo(),
105
  CryptoDataTools(),
106
  CryptoSwapTools(),
107
- CrossChainSwapTools(),
108
  UserProfileToolkit(),
109
  CryptoEVMWalletTools(),
110
  UserConfirmationPinToolkit(),
@@ -119,31 +112,34 @@ async def start():
119
  add_references_to_prompt=True,
120
  add_chat_history_to_prompt=True,
121
  prevent_hallucinations=True,
122
- prevent_prompt_injection=True
 
123
  )
124
  cxbt_assistant.knowledge_base.load(recreate=False)
125
 
126
  # Set the assistant in the user session
127
  cl.user_session.set("agent", cxbt_assistant)
128
 
 
129
  @cl.on_message
130
  async def main(message: cl.Message):
131
-
132
  msg = cl.Message(content="")
133
- await msg.send()
134
 
135
  # Retrieve the assistant from the user session
136
  agent = cl.user_session.get("agent")
137
 
138
  # Process the user message using the assistant
139
- for delta in agent.run(message.content, stream=True):
140
- for part in delta:
141
- if token := part or "":
142
- # Send the response back to the user
143
- await msg.stream_token(token)
 
 
 
144
 
145
- await msg.update()
146
 
147
  # Run the Chainlit application
148
  if __name__ == "__main__":
149
- cl.run()
 
1
+ import os
2
  from typing import Optional, Dict
3
  from dotenv import load_dotenv
 
 
 
4
  import chainlit as cl
5
  from phi.assistant import Assistant
6
  from phi.llm.openai import OpenAIChat
 
 
7
  from phi.tools.duckduckgo import DuckDuckGo
8
  from phi.tools.yfinance import YFinanceTools
9
  from src.databases.postgres import sqlalchemy_engine
10
  from src.knowledge_bases.combined import knowledge_base
11
  from src.tools.crypto_swap_toolkit import CryptoSwapTools
 
12
  from src.tools.crypto_data_toolkit import CryptoDataTools
13
  from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
14
  from src.config.portkey_config import generate_portkey_config
 
17
  from src.tools.crypto_evm_wallet_toolkit import CryptoEVMWalletTools
18
  from src.tools.user_confirmation_pin_toolkit import UserConfirmationPinToolkit
19
 
20
+ # Load environment variables
21
+ load_dotenv()
22
 
23
+ # Initialize storage
24
  storage = PgAssistantStorage(
 
25
  table_name="assistant_runs",
26
  db_engine=sqlalchemy_engine
27
  )
28
 
29
+ # OAuth callback
30
  @cl.oauth_callback
31
+ def oauth_callback(provider_id: str, token: str, raw_user_data: Dict[str, str], default_user: cl.User) -> Optional[cl.User]:
 
 
 
 
 
 
32
  return cl.User(
33
  identifier=raw_user_data.get('email'),
34
  email=raw_user_data.get('email'),
35
  name=raw_user_data.get('name'),
36
+ metadata={**raw_user_data, **({'image': default_user.metadata.get('image')})}
37
  )
38
 
39
+ # Password authentication callback
40
  @cl.password_auth_callback
41
+ def auth_callback(username: str, password: str) -> Optional[cl.User]:
 
 
42
  if (username, password) == ("admin", "admin"):
43
  user = {
44
  "identifier": "admin", "email": username, "metadata": {"role": "admin", "provider": "credentials"}
 
47
  return cl.User(
48
  identifier="admin", email=username, metadata={"role": "admin", "provider": "credentials"}
49
  )
50
+ return None
 
 
51
 
52
+ # Set starters
53
  @cl.set_starters
54
  async def set_starters():
55
  return [
 
58
  message="create a crypto wallet for me",
59
  icon="/public/wallet-svgrepo-com.svg",
60
  ),
 
61
  cl.Starter(
62
  label="Latest News on defi, crypto and solana",
63
+ message="What news are currently trending on defi.",
64
  icon="/public/news-svgrepo-com.svg",
65
+ ),
66
  cl.Starter(
67
  label="Get price of BTC, ETH and PEPE",
68
+ message="Get me the price of BTC, ETH and PEPE",
69
  icon="/public/coins-electronics-svgrepo-com.svg",
70
+ ),
71
  cl.Starter(
72
  label="Get trending stocks",
73
  message="Get latest stock",
74
  icon="/public/stockchart-svgrepo-com.svg",
75
+ )
76
+ ]
77
 
78
+ # On chat start
79
  @cl.on_chat_start
80
  async def start():
81
+ is_dev_mode = bool(os.getenv("DEV_MODE"))
82
+ portkey_local_gateway = bool(os.getenv("PORTKEY_LOCAL_GATEWAY_URL"))
 
83
  portkey_config = generate_portkey_config(local=portkey_local_gateway)
84
 
85
  # Initialize the assistant
86
  cxbt_assistant = Assistant(
87
+ introduction="Hi, I'm ChatXBT, your AI assistant for Web3 and DeFi. I can help you with your queries related to Web3 and DeFi.",
88
+ llm=OpenAIChat(
89
+ api_key=os.getenv("PORTKEY_API_KEY"),
90
+ # base_url=os.getenv("PORTKEY_LOCAL_GATEWAY_URL") or PORTKEY_GATEWAY_URL,
91
+ base_url=PORTKEY_GATEWAY_URL,
92
+ default_headers=createHeaders(
93
+ api_key=os.getenv("PORTKEY_API_KEY") or None,
94
+ config=portkey_config
95
+ ),
96
+ ),
97
  tools=[
98
  DuckDuckGo(),
99
  CryptoDataTools(),
100
  CryptoSwapTools(),
 
101
  UserProfileToolkit(),
102
  CryptoEVMWalletTools(),
103
  UserConfirmationPinToolkit(),
 
112
  add_references_to_prompt=True,
113
  add_chat_history_to_prompt=True,
114
  prevent_hallucinations=True,
115
+ prevent_prompt_injection=True,
116
+ add_datetime_to_instructions=True
117
  )
118
  cxbt_assistant.knowledge_base.load(recreate=False)
119
 
120
  # Set the assistant in the user session
121
  cl.user_session.set("agent", cxbt_assistant)
122
 
123
+ # On message
124
  @cl.on_message
125
  async def main(message: cl.Message):
 
126
  msg = cl.Message(content="")
 
127
 
128
  # Retrieve the assistant from the user session
129
  agent = cl.user_session.get("agent")
130
 
131
  # Process the user message using the assistant
132
+ try:
133
+ response_generator = agent.run(message=message.content, stream=True)
134
+ for delta in response_generator:
135
+ await msg.stream_token(str(delta))
136
+ except TypeError as e:
137
+ # Handle specific TypeError and log or print additional information for debugging
138
+ print(f"Error occurred: {e}")
139
+ await msg.stream_token(f"\n\n I encountetrd an error, please try again later.")
140
 
141
+ await msg.send()
142
 
143
  # Run the Chainlit application
144
  if __name__ == "__main__":
145
+ cl.run_sync()
lite-llm-config.yaml DELETED
@@ -1,15 +0,0 @@
1
- model_list:
2
- - model_name: gpt-3.5-turbo # user-facing model alias
3
- litellm_params: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input
4
- model: azure/<your-deployment-name>
5
- api_base: <your-azure-api-endpoint>
6
- api_key: <your-azure-api-key>
7
- - model_name: gpt-3.5-turbo
8
- litellm_params:
9
- model: azure/gpt-turbo-small-ca
10
- api_base: https://my-endpoint-canada-berri992.openai.azure.com/
11
- api_key: <your-azure-api-key>
12
- - model_name: vllm-model
13
- litellm_params:
14
- model: openai/<your-model-name>
15
- api_base: <your-api-base> # e.g. http://0.0.0.0:3000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.bk.txt CHANGED
@@ -1,52 +1,134 @@
 
 
1
  aiohttp==3.9.5
 
2
  aiosignal==1.3.1
3
  annotated-types==0.7.0
4
- anyio==4.4.0
 
 
5
  appnope==0.1.4
 
6
  asgiref==3.8.1
7
  asttokens==2.4.1
8
  async-timeout==4.0.3
 
9
  attrs==23.2.0
10
  backcall==0.2.0
 
 
11
  beautifulsoup4==4.12.3
 
 
12
  bleach==6.1.0
13
- certifi==2024.6.2
 
 
 
 
 
14
  charset-normalizer==3.3.2
 
 
 
15
  coingecko==0.13
 
 
 
16
  decorator==5.1.1
17
  defusedxml==0.7.1
18
  Deprecated==1.2.14
 
 
19
  docopt==0.6.2
20
- exceptiongroup==1.2.1
 
 
 
 
 
 
 
 
 
 
21
  executing==2.0.1
22
- fastjsonschema==2.19.1
 
 
 
 
 
 
23
  frozenlist==1.4.1
24
- googleapis-common-protos==1.63.1
 
 
 
 
 
 
 
 
 
25
  h11==0.14.0
 
 
26
  httpcore==1.0.5
 
27
  httpx==0.27.0
 
28
  idna==3.7
29
  importlib_metadata==7.1.0
30
  ipython==8.12.3
31
  jedi==0.19.1
32
  Jinja2==3.1.4
33
- jsonschema==4.22.0
 
 
 
 
34
  jsonschema-specifications==2023.12.1
35
  jupyter_client==8.6.2
36
  jupyter_core==5.7.2
37
  jupyterlab_pygments==0.3.0
38
- logfire==0.42.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  markdown-it-py==3.0.0
40
  MarkupSafe==2.1.5
 
41
  matplotlib-inline==0.1.7
42
  mdurl==0.1.2
43
  mistune==3.0.2
44
  multidict==6.0.5
 
 
 
45
  nbclient==0.10.0
46
  nbconvert==7.16.4
47
  nbformat==5.10.4
 
 
 
 
 
48
  opentelemetry-api==1.25.0
 
49
  opentelemetry-exporter-otlp-proto-common==1.25.0
 
50
  opentelemetry-exporter-otlp-proto-http==1.25.0
51
  opentelemetry-instrumentation==0.46b0
52
  opentelemetry-instrumentation-asgi==0.46b0
@@ -59,46 +141,99 @@ opentelemetry-proto==1.25.0
59
  opentelemetry-sdk==1.25.0
60
  opentelemetry-semantic-conventions==0.46b0
61
  opentelemetry-util-http==0.46b0
62
- packaging==24.1
 
 
63
  pandocfilters==1.5.1
 
64
  parso==0.8.4
 
65
  pexpect==4.9.0
 
 
66
  pickleshare==0.7.5
67
- pipdeptree==2.22.0
68
  pipreqs==0.5.0
69
  platformdirs==4.2.2
 
70
  prompt_toolkit==3.0.47
71
  protobuf==4.25.3
72
  psutil==5.9.8
 
 
73
  ptyprocess==0.7.0
74
  pure-eval==0.2.2
75
- pydantic==2.7.4
76
- pydantic_core==2.18.4
 
 
 
77
  Pygments==2.18.0
 
 
 
78
  python-dateutil==2.9.0.post0
79
  python-dotenv==1.0.1
80
- python-ulid==2.6.0
 
 
 
 
 
 
81
  pyzmq==26.0.3
82
- redis==5.0.6
83
  referencing==0.35.1
 
84
  requests==2.32.3
85
  rich==13.7.1
86
- rpds-py==0.18.1
 
 
 
 
 
 
 
 
87
  six==1.16.0
 
88
  sniffio==1.3.1
89
  soupsieve==2.5
 
90
  stack-data==0.6.3
 
 
 
 
 
91
  tinycss2==1.3.0
 
92
  tomli==2.0.1
 
93
  tornado==6.4.1
 
94
  traitlets==5.14.3
 
 
 
95
  typing_extensions==4.12.2
 
 
96
  ulid==1.1
97
  upstash-redis==1.1.0
98
- urllib3==2.2.1
 
 
 
 
99
  wcwidth==0.2.13
 
100
  webencodings==0.5.1
 
101
  wrapt==1.16.0
 
102
  yarg==0.1.9
103
  yarl==1.9.4
 
104
  zipp==3.19.2
 
1
+ aiobotocore==2.13.1
2
+ aiofiles==23.2.1
3
  aiohttp==3.9.5
4
+ aioitertools==0.11.0
5
  aiosignal==1.3.1
6
  annotated-types==0.7.0
7
+ anthropic==0.31.1
8
+ anyio==3.7.1
9
+ appdirs==1.4.4
10
  appnope==0.1.4
11
+ APScheduler==3.10.4
12
  asgiref==3.8.1
13
  asttokens==2.4.1
14
  async-timeout==4.0.3
15
+ asyncer==0.0.2
16
  attrs==23.2.0
17
  backcall==0.2.0
18
+ backoff==2.2.1
19
+ baize==0.20.8
20
  beautifulsoup4==4.12.3
21
+ bidict==0.23.1
22
+ bitarray==2.9.2
23
  bleach==6.1.0
24
+ boto3==1.34.131
25
+ botocore==1.34.131
26
+ cached-property==1.5.2
27
+ certifi==2024.7.4
28
+ cffi==1.16.0
29
+ chainlit==1.1.306
30
  charset-normalizer==3.3.2
31
+ chevron==0.14.0
32
+ ckzg==1.0.2
33
+ click==8.1.7
34
  coingecko==0.13
35
+ cryptography==42.0.8
36
+ cytoolz==0.12.3
37
+ dataclasses-json==0.5.14
38
  decorator==5.1.1
39
  defusedxml==0.7.1
40
  Deprecated==1.2.14
41
+ distro==1.9.0
42
+ dnspython==2.6.1
43
  docopt==0.6.2
44
+ duckduckgo_search==6.2.1
45
+ email_validator==2.2.0
46
+ eth-account==0.13.0
47
+ eth-hash==0.7.0
48
+ eth-keyfile==0.8.1
49
+ eth-keys==0.5.1
50
+ eth-rlp==2.1.0
51
+ eth-typing==4.4.0
52
+ eth-utils==4.1.1
53
+ eth_abi==5.1.0
54
+ exceptiongroup==1.2.2
55
  executing==2.0.1
56
+ fastapi==0.110.3
57
+ fastapi-cli==0.0.4
58
+ fastapi-sso==0.15.0
59
+ fastjsonschema==2.20.0
60
+ filelock==3.15.4
61
+ filetype==1.2.0
62
+ frozendict==2.4.4
63
  frozenlist==1.4.1
64
+ fs==2.4.16
65
+ fs-s3fs==1.1.1
66
+ fsspec==2024.6.1
67
+ gitdb==4.0.11
68
+ GitPython==3.1.43
69
+ google_search_results==2.4.2
70
+ googleapis-common-protos==1.63.2
71
+ greenlet==3.0.3
72
+ grpcio==1.64.1
73
+ gunicorn==22.0.0
74
  h11==0.14.0
75
+ hexbytes==1.2.1
76
+ html5lib==1.1
77
  httpcore==1.0.5
78
+ httptools==0.6.1
79
  httpx==0.27.0
80
+ huggingface-hub==0.23.5
81
  idna==3.7
82
  importlib_metadata==7.1.0
83
  ipython==8.12.3
84
  jedi==0.19.1
85
  Jinja2==3.1.4
86
+ jiter==0.5.0
87
+ jmespath==1.0.1
88
+ jsonpatch==1.33
89
+ jsonpointer==3.0.0
90
+ jsonschema==4.23.0
91
  jsonschema-specifications==2023.12.1
92
  jupyter_client==8.6.2
93
  jupyter_core==5.7.2
94
  jupyterlab_pygments==0.3.0
95
+ langchain==0.2.8
96
+ langchain-anthropic==0.1.20
97
+ langchain-community==0.2.7
98
+ langchain-core==0.2.20
99
+ langchain-openai==0.1.16
100
+ langchain-text-splitters==0.2.2
101
+ langchainhub==0.1.20
102
+ langgraph==0.1.8
103
+ langsmith==0.1.88
104
+ Lazify==0.4.0
105
+ litellm==1.41.23
106
+ literalai==0.0.607
107
+ logfire==0.46.1
108
+ lru-dict==1.3.0
109
+ lxml==5.2.2
110
  markdown-it-py==3.0.0
111
  MarkupSafe==2.1.5
112
+ marshmallow==3.21.3
113
  matplotlib-inline==0.1.7
114
  mdurl==0.1.2
115
  mistune==3.0.2
116
  multidict==6.0.5
117
+ multitasking==0.0.11
118
+ mypy==1.10.1
119
+ mypy-extensions==1.0.0
120
  nbclient==0.10.0
121
  nbconvert==7.16.4
122
  nbformat==5.10.4
123
+ nest-asyncio==1.6.0
124
+ numexpr==2.10.1
125
+ numpy==1.26.4
126
+ oauthlib==3.2.2
127
+ openai==1.35.14
128
  opentelemetry-api==1.25.0
129
+ opentelemetry-exporter-otlp==1.25.0
130
  opentelemetry-exporter-otlp-proto-common==1.25.0
131
+ opentelemetry-exporter-otlp-proto-grpc==1.25.0
132
  opentelemetry-exporter-otlp-proto-http==1.25.0
133
  opentelemetry-instrumentation==0.46b0
134
  opentelemetry-instrumentation-asgi==0.46b0
 
141
  opentelemetry-sdk==1.25.0
142
  opentelemetry-semantic-conventions==0.46b0
143
  opentelemetry-util-http==0.46b0
144
+ orjson==3.10.6
145
+ packaging==23.2
146
+ pandas==2.2.2
147
  pandocfilters==1.5.1
148
+ parsimonious==0.10.0
149
  parso==0.8.4
150
+ peewee==3.17.6
151
  pexpect==4.9.0
152
+ pgvector==0.3.1
153
+ phidata==2.4.25
154
  pickleshare==0.7.5
155
+ pipdeptree==2.23.1
156
  pipreqs==0.5.0
157
  platformdirs==4.2.2
158
+ portkey-ai==1.7.0
159
  prompt_toolkit==3.0.47
160
  protobuf==4.25.3
161
  psutil==5.9.8
162
+ psycopg==3.2.1
163
+ psycopg2==2.9.9
164
  ptyprocess==0.7.0
165
  pure-eval==0.2.2
166
+ pycparser==2.22
167
+ pycryptodome==3.20.0
168
+ pydantic==2.8.2
169
+ pydantic-settings==2.3.4
170
+ pydantic_core==2.20.1
171
  Pygments==2.18.0
172
+ PyJWT==2.8.0
173
+ pypeln==0.4.9
174
+ pyreqwest_impersonate==0.5.0
175
  python-dateutil==2.9.0.post0
176
  python-dotenv==1.0.1
177
+ python-engineio==4.9.1
178
+ python-multipart==0.0.9
179
+ python-socketio==5.11.3
180
+ python-ulid==2.7.0
181
+ pytz==2024.1
182
+ pyunormalize==15.1.0
183
+ PyYAML==6.0.1
184
  pyzmq==26.0.3
185
+ redis==5.0.7
186
  referencing==0.35.1
187
+ regex==2024.5.15
188
  requests==2.32.3
189
  rich==13.7.1
190
+ rlp==4.0.1
191
+ rpc.py==0.6.0
192
+ rpds-py==0.19.0
193
+ rq==1.16.2
194
+ s3fs==2024.6.1
195
+ s3transfer==0.10.2
196
+ setuptools==70.3.0
197
+ shellingham==1.5.4
198
+ simple-websocket==1.0.0
199
  six==1.16.0
200
+ smmap==5.0.1
201
  sniffio==1.3.1
202
  soupsieve==2.5
203
+ SQLAlchemy==2.0.31
204
  stack-data==0.6.3
205
+ starlette==0.37.2
206
+ stopit==1.1.2
207
+ syncer==2.0.3
208
+ tenacity==8.5.0
209
+ tiktoken==0.7.0
210
  tinycss2==1.3.0
211
+ tokenizers==0.19.1
212
  tomli==2.0.1
213
+ toolz==0.12.1
214
  tornado==6.4.1
215
+ tqdm==4.66.4
216
  traitlets==5.14.3
217
+ typer==0.12.3
218
+ types-requests==2.32.0.20240712
219
+ typing-inspect==0.9.0
220
  typing_extensions==4.12.2
221
+ tzdata==2024.1
222
+ tzlocal==5.2
223
  ulid==1.1
224
  upstash-redis==1.1.0
225
+ uptrace==1.24.0
226
+ urllib3==2.2.2
227
+ uvicorn==0.25.0
228
+ uvloop==0.19.0
229
+ watchfiles==0.20.0
230
  wcwidth==0.2.13
231
+ web3==6.11.0
232
  webencodings==0.5.1
233
+ websockets==12.0
234
  wrapt==1.16.0
235
+ wsproto==1.2.0
236
  yarg==0.1.9
237
  yarl==1.9.4
238
+ yfinance==0.2.40
239
  zipp==3.19.2
requirements.txt CHANGED
@@ -1,10 +1,10 @@
1
- aiobotocore==2.13.0
2
  aiofiles==23.2.1
3
  aiohttp==3.9.5
4
  aioitertools==0.11.0
5
  aiosignal==1.3.1
6
  annotated-types==0.7.0
7
- anthropic==0.28.0
8
  anyio==3.7.1
9
  appdirs==1.4.4
10
  appnope==0.1.4
@@ -21,12 +21,12 @@ beautifulsoup4==4.12.3
21
  bidict==0.23.1
22
  bitarray==2.9.2
23
  bleach==6.1.0
24
- boto3==1.34.106
25
- botocore==1.34.106
26
  cached-property==1.5.2
27
- certifi==2024.6.2
28
  cffi==1.16.0
29
- chainlit==1.1.300
30
  charset-normalizer==3.3.2
31
  chevron==0.14.0
32
  ckzg==1.0.2
@@ -41,71 +41,71 @@ Deprecated==1.2.14
41
  distro==1.9.0
42
  dnspython==2.6.1
43
  docopt==0.6.2
44
- duckduckgo_search==6.1.6
45
  email_validator==2.2.0
46
- eth-account==0.11.2
47
  eth-hash==0.7.0
48
  eth-keyfile==0.8.1
49
  eth-keys==0.5.1
50
- eth-rlp==1.0.1
51
- eth-typing==4.3.1
52
  eth-utils==4.1.1
53
  eth_abi==5.1.0
54
- exceptiongroup==1.2.1
55
  executing==2.0.1
56
- fastapi==0.111.1
57
  fastapi-cli==0.0.4
58
- fastapi-sso==0.10.0
59
- fastjsonschema==2.19.1
60
- filelock==3.15.1
61
  filetype==1.2.0
62
  frozendict==2.4.4
63
  frozenlist==1.4.1
64
  fs==2.4.16
65
  fs-s3fs==1.1.1
66
- fsspec==2024.6.0
67
  gitdb==4.0.11
68
  GitPython==3.1.43
69
  google_search_results==2.4.2
70
- googleapis-common-protos==1.63.1
71
  greenlet==3.0.3
72
  grpcio==1.64.1
73
  gunicorn==22.0.0
74
  h11==0.14.0
75
- hexbytes==0.3.1
76
  html5lib==1.1
77
  httpcore==1.0.5
78
  httptools==0.6.1
79
  httpx==0.27.0
80
- huggingface-hub==0.23.3
81
  idna==3.7
82
  importlib_metadata==7.1.0
83
  ipython==8.12.3
84
  jedi==0.19.1
85
  Jinja2==3.1.4
86
- jiter==0.4.2
87
  jmespath==1.0.1
88
  jsonpatch==1.33
89
  jsonpointer==3.0.0
90
- jsonschema==4.22.0
91
  jsonschema-specifications==2023.12.1
92
  jupyter_client==8.6.2
93
  jupyter_core==5.7.2
94
  jupyterlab_pygments==0.3.0
95
- langchain==0.2.4
96
- langchain-anthropic==0.1.15
97
- langchain-community==0.2.4
98
- langchain-core==0.2.6
99
- langchain-openai==0.1.8
100
- langchain-text-splitters==0.2.1
101
  langchainhub==0.1.20
102
- langgraph==0.0.68
103
- langsmith==0.1.77
104
  Lazify==0.4.0
105
- litellm==1.41.21
106
- literalai==0.0.604
107
- logfire==0.42.0
108
- lru-dict==1.2.0
109
  lxml==5.2.2
110
  markdown-it-py==3.0.0
111
  MarkupSafe==2.1.5
@@ -121,10 +121,10 @@ nbclient==0.10.0
121
  nbconvert==7.16.4
122
  nbformat==5.10.4
123
  nest-asyncio==1.6.0
124
- numexpr==2.10.0
125
  numpy==1.26.4
126
  oauthlib==3.2.2
127
- openai==1.34.0
128
  opentelemetry-api==1.25.0
129
  opentelemetry-exporter-otlp==1.25.0
130
  opentelemetry-exporter-otlp-proto-common==1.25.0
@@ -141,70 +141,71 @@ opentelemetry-proto==1.25.0
141
  opentelemetry-sdk==1.25.0
142
  opentelemetry-semantic-conventions==0.46b0
143
  opentelemetry-util-http==0.46b0
144
- orjson==3.10.5
145
  packaging==23.2
146
  pandas==2.2.2
147
  pandocfilters==1.5.1
148
  parsimonious==0.10.0
149
  parso==0.8.4
150
- peewee==3.17.5
151
  pexpect==4.9.0
152
- pgvector==0.2.5
153
- phidata==2.4.20
154
  pickleshare==0.7.5
155
- pipdeptree==2.22.0
156
  pipreqs==0.5.0
157
  platformdirs==4.2.2
158
  portkey-ai==1.7.0
159
  prompt_toolkit==3.0.47
160
  protobuf==4.25.3
161
  psutil==5.9.8
162
- psycopg==3.1.19
163
  psycopg2==2.9.9
164
  ptyprocess==0.7.0
165
  pure-eval==0.2.2
166
  pycparser==2.22
167
  pycryptodome==3.20.0
168
- pydantic==2.7.4
169
- pydantic-settings==2.3.3
170
- pydantic_core==2.18.4
171
  Pygments==2.18.0
172
  PyJWT==2.8.0
173
  pypeln==0.4.9
174
- pyreqwest_impersonate==0.4.7
175
  python-dateutil==2.9.0.post0
176
  python-dotenv==1.0.1
177
  python-engineio==4.9.1
178
  python-multipart==0.0.9
179
- python-socketio==5.11.2
180
- python-ulid==2.6.0
181
  pytz==2024.1
182
  pyunormalize==15.1.0
183
  PyYAML==6.0.1
184
  pyzmq==26.0.3
185
- redis==5.0.6
186
  referencing==0.35.1
187
  regex==2024.5.15
188
  requests==2.32.3
189
  rich==13.7.1
190
  rlp==4.0.1
191
  rpc.py==0.6.0
192
- rpds-py==0.18.1
193
  rq==1.16.2
194
- s3fs==2024.6.0
195
- s3transfer==0.10.1
 
196
  shellingham==1.5.4
197
  simple-websocket==1.0.0
198
  six==1.16.0
199
  smmap==5.0.1
200
  sniffio==1.3.1
201
  soupsieve==2.5
202
- SQLAlchemy==2.0.30
203
  stack-data==0.6.3
204
  starlette==0.37.2
205
  stopit==1.1.2
206
  syncer==2.0.3
207
- tenacity==8.3.0
208
  tiktoken==0.7.0
209
  tinycss2==1.3.0
210
  tokenizers==0.19.1
@@ -214,7 +215,7 @@ tornado==6.4.1
214
  tqdm==4.66.4
215
  traitlets==5.14.3
216
  typer==0.12.3
217
- types-requests==2.32.0.20240602
218
  typing-inspect==0.9.0
219
  typing_extensions==4.12.2
220
  tzdata==2024.1
@@ -222,12 +223,12 @@ tzlocal==5.2
222
  ulid==1.1
223
  upstash-redis==1.1.0
224
  uptrace==1.24.0
225
- urllib3==2.2.1
226
- uvicorn==0.22.0
227
  uvloop==0.19.0
228
  watchfiles==0.20.0
229
  wcwidth==0.2.13
230
- web3==6.19.0
231
  webencodings==0.5.1
232
  websockets==12.0
233
  wrapt==1.16.0
 
1
+ aiobotocore==2.13.1
2
  aiofiles==23.2.1
3
  aiohttp==3.9.5
4
  aioitertools==0.11.0
5
  aiosignal==1.3.1
6
  annotated-types==0.7.0
7
+ anthropic==0.31.1
8
  anyio==3.7.1
9
  appdirs==1.4.4
10
  appnope==0.1.4
 
21
  bidict==0.23.1
22
  bitarray==2.9.2
23
  bleach==6.1.0
24
+ boto3==1.34.131
25
+ botocore==1.34.131
26
  cached-property==1.5.2
27
+ certifi==2024.7.4
28
  cffi==1.16.0
29
+ chainlit==1.1.306
30
  charset-normalizer==3.3.2
31
  chevron==0.14.0
32
  ckzg==1.0.2
 
41
  distro==1.9.0
42
  dnspython==2.6.1
43
  docopt==0.6.2
44
+ duckduckgo_search==6.2.1
45
  email_validator==2.2.0
46
+ eth-account==0.13.0
47
  eth-hash==0.7.0
48
  eth-keyfile==0.8.1
49
  eth-keys==0.5.1
50
+ eth-rlp==2.1.0
51
+ eth-typing==4.4.0
52
  eth-utils==4.1.1
53
  eth_abi==5.1.0
54
+ exceptiongroup==1.2.2
55
  executing==2.0.1
56
+ fastapi==0.110.3
57
  fastapi-cli==0.0.4
58
+ fastapi-sso==0.15.0
59
+ fastjsonschema==2.20.0
60
+ filelock==3.15.4
61
  filetype==1.2.0
62
  frozendict==2.4.4
63
  frozenlist==1.4.1
64
  fs==2.4.16
65
  fs-s3fs==1.1.1
66
+ fsspec==2024.6.1
67
  gitdb==4.0.11
68
  GitPython==3.1.43
69
  google_search_results==2.4.2
70
+ googleapis-common-protos==1.63.2
71
  greenlet==3.0.3
72
  grpcio==1.64.1
73
  gunicorn==22.0.0
74
  h11==0.14.0
75
+ hexbytes==1.2.1
76
  html5lib==1.1
77
  httpcore==1.0.5
78
  httptools==0.6.1
79
  httpx==0.27.0
80
+ huggingface-hub==0.23.5
81
  idna==3.7
82
  importlib_metadata==7.1.0
83
  ipython==8.12.3
84
  jedi==0.19.1
85
  Jinja2==3.1.4
86
+ jiter==0.5.0
87
  jmespath==1.0.1
88
  jsonpatch==1.33
89
  jsonpointer==3.0.0
90
+ jsonschema==4.23.0
91
  jsonschema-specifications==2023.12.1
92
  jupyter_client==8.6.2
93
  jupyter_core==5.7.2
94
  jupyterlab_pygments==0.3.0
95
+ langchain==0.2.8
96
+ langchain-anthropic==0.1.20
97
+ langchain-community==0.2.7
98
+ langchain-core==0.2.20
99
+ langchain-openai==0.1.16
100
+ langchain-text-splitters==0.2.2
101
  langchainhub==0.1.20
102
+ langgraph==0.1.8
103
+ langsmith==0.1.88
104
  Lazify==0.4.0
105
+ litellm==1.41.23
106
+ literalai==0.0.607
107
+ logfire==0.46.1
108
+ lru-dict==1.3.0
109
  lxml==5.2.2
110
  markdown-it-py==3.0.0
111
  MarkupSafe==2.1.5
 
121
  nbconvert==7.16.4
122
  nbformat==5.10.4
123
  nest-asyncio==1.6.0
124
+ numexpr==2.10.1
125
  numpy==1.26.4
126
  oauthlib==3.2.2
127
+ openai==1.35.14
128
  opentelemetry-api==1.25.0
129
  opentelemetry-exporter-otlp==1.25.0
130
  opentelemetry-exporter-otlp-proto-common==1.25.0
 
141
  opentelemetry-sdk==1.25.0
142
  opentelemetry-semantic-conventions==0.46b0
143
  opentelemetry-util-http==0.46b0
144
+ orjson==3.10.6
145
  packaging==23.2
146
  pandas==2.2.2
147
  pandocfilters==1.5.1
148
  parsimonious==0.10.0
149
  parso==0.8.4
150
+ peewee==3.17.6
151
  pexpect==4.9.0
152
+ pgvector==0.3.1
153
+ phidata==2.4.25
154
  pickleshare==0.7.5
155
+ pipdeptree==2.23.1
156
  pipreqs==0.5.0
157
  platformdirs==4.2.2
158
  portkey-ai==1.7.0
159
  prompt_toolkit==3.0.47
160
  protobuf==4.25.3
161
  psutil==5.9.8
162
+ psycopg==3.2.1
163
  psycopg2==2.9.9
164
  ptyprocess==0.7.0
165
  pure-eval==0.2.2
166
  pycparser==2.22
167
  pycryptodome==3.20.0
168
+ pydantic==2.8.2
169
+ pydantic-settings==2.3.4
170
+ pydantic_core==2.20.1
171
  Pygments==2.18.0
172
  PyJWT==2.8.0
173
  pypeln==0.4.9
174
+ pyreqwest_impersonate==0.5.0
175
  python-dateutil==2.9.0.post0
176
  python-dotenv==1.0.1
177
  python-engineio==4.9.1
178
  python-multipart==0.0.9
179
+ python-socketio==5.11.3
180
+ python-ulid==2.7.0
181
  pytz==2024.1
182
  pyunormalize==15.1.0
183
  PyYAML==6.0.1
184
  pyzmq==26.0.3
185
+ redis==5.0.7
186
  referencing==0.35.1
187
  regex==2024.5.15
188
  requests==2.32.3
189
  rich==13.7.1
190
  rlp==4.0.1
191
  rpc.py==0.6.0
192
+ rpds-py==0.19.0
193
  rq==1.16.2
194
+ s3fs==2024.6.1
195
+ s3transfer==0.10.2
196
+ setuptools==70.3.0
197
  shellingham==1.5.4
198
  simple-websocket==1.0.0
199
  six==1.16.0
200
  smmap==5.0.1
201
  sniffio==1.3.1
202
  soupsieve==2.5
203
+ SQLAlchemy==2.0.31
204
  stack-data==0.6.3
205
  starlette==0.37.2
206
  stopit==1.1.2
207
  syncer==2.0.3
208
+ tenacity==8.5.0
209
  tiktoken==0.7.0
210
  tinycss2==1.3.0
211
  tokenizers==0.19.1
 
215
  tqdm==4.66.4
216
  traitlets==5.14.3
217
  typer==0.12.3
218
+ types-requests==2.32.0.20240712
219
  typing-inspect==0.9.0
220
  typing_extensions==4.12.2
221
  tzdata==2024.1
 
223
  ulid==1.1
224
  upstash-redis==1.1.0
225
  uptrace==1.24.0
226
+ urllib3==2.2.2
227
+ uvicorn==0.25.0
228
  uvloop==0.19.0
229
  watchfiles==0.20.0
230
  wcwidth==0.2.13
231
+ web3==6.11.0
232
  webencodings==0.5.1
233
  websockets==12.0
234
  wrapt==1.16.0
src/config/portkey_config.py CHANGED
@@ -13,7 +13,6 @@ def generate_portkey_config(local: bool = True):
13
  },
14
  "retry": {
15
  "attempts": 3,
16
- "on_status_codes": [429]
17
  },
18
  "targets": [
19
  # {
@@ -30,8 +29,8 @@ def generate_portkey_config(local: bool = True):
30
  "api_key": os.getenv("ANTHROPIC_API_KEY"),
31
  "override_params": {
32
  "model": "claude-3-5-sonnet-20240620",
33
- "max_tokens": 1024,
34
- "temperature": 0
35
  }
36
  },
37
  {
@@ -39,8 +38,8 @@ def generate_portkey_config(local: bool = True):
39
  "api_key": os.getenv("OPENAI_API_KEY"),
40
  "override_params": {
41
  "model": "gpt-4o",
42
- "max_tokens": 1024,
43
- "temperature": 0
44
  }
45
  },
46
  {
@@ -48,8 +47,8 @@ def generate_portkey_config(local: bool = True):
48
  "api_key": os.getenv("ANTHROPIC_API_KEY"),
49
  "override_params": {
50
  "model": "claude-3-opus-20240229",
51
- "max_tokens": 1024,
52
- "temperature": 0
53
  }
54
  }
55
  ]
@@ -65,16 +64,14 @@ def generate_portkey_config(local: bool = True):
65
  },
66
  "retry": {
67
  "attempts": 3,
68
- "on_status_codes": [429]
69
  },
70
  "targets": [
71
-
72
  {
73
  "virtual_key": os.getenv("PORTKEY_OPENAI_VIRTUAL_KEY"),
74
  "override_params": {
75
  "model": "gpt-4o",
76
- "max_tokens": 1024,
77
- "temperature": 0
78
  }
79
  },
80
  {
@@ -82,24 +79,24 @@ def generate_portkey_config(local: bool = True):
82
  "api_key": os.getenv("POETRY_ANTHROPIC_API_KEY"),
83
  "override_params": {
84
  "model": "claude-3-5-sonnet-20240620",
85
- "max_tokens": 1024,
86
- "temperature": 0
87
  }
88
  },
89
  {
90
  "virtual_key": os.getenv("PORTKEY_ANTHROPIC_API_KEY"),
91
  "override_params": {
92
  "model": "claude-3-opus-20240229",
93
- "max_tokens": 1024,
94
- "temperature": 0
95
  }
96
  },
97
  {
98
  "virtual_key": os.getenv("PORTKEY_MISTRAL_API_KEY"),
99
  "override_params": {
100
  "model": "codestral-latest",
101
- "max_tokens": 1024,
102
- "temperature": 0
103
  }
104
  }
105
  ]
 
13
  },
14
  "retry": {
15
  "attempts": 3,
 
16
  },
17
  "targets": [
18
  # {
 
29
  "api_key": os.getenv("ANTHROPIC_API_KEY"),
30
  "override_params": {
31
  "model": "claude-3-5-sonnet-20240620",
32
+ # "max_tokens": 1024,
33
+ # "temperature": 0
34
  }
35
  },
36
  {
 
38
  "api_key": os.getenv("OPENAI_API_KEY"),
39
  "override_params": {
40
  "model": "gpt-4o",
41
+ # "max_tokens": 1024,
42
+ # "temperature": 0
43
  }
44
  },
45
  {
 
47
  "api_key": os.getenv("ANTHROPIC_API_KEY"),
48
  "override_params": {
49
  "model": "claude-3-opus-20240229",
50
+ # "max_tokens": 1024,
51
+ # "temperature": 0
52
  }
53
  }
54
  ]
 
64
  },
65
  "retry": {
66
  "attempts": 3,
 
67
  },
68
  "targets": [
 
69
  {
70
  "virtual_key": os.getenv("PORTKEY_OPENAI_VIRTUAL_KEY"),
71
  "override_params": {
72
  "model": "gpt-4o",
73
+ # "max_tokens": 1024,
74
+ # "temperature": 0
75
  }
76
  },
77
  {
 
79
  "api_key": os.getenv("POETRY_ANTHROPIC_API_KEY"),
80
  "override_params": {
81
  "model": "claude-3-5-sonnet-20240620",
82
+ # "max_tokens": 1024,
83
+ # "temperature": 0
84
  }
85
  },
86
  {
87
  "virtual_key": os.getenv("PORTKEY_ANTHROPIC_API_KEY"),
88
  "override_params": {
89
  "model": "claude-3-opus-20240229",
90
+ # "max_tokens": 1024,
91
+ # "temperature": 0
92
  }
93
  },
94
  {
95
  "virtual_key": os.getenv("PORTKEY_MISTRAL_API_KEY"),
96
  "override_params": {
97
  "model": "codestral-latest",
98
+ # "max_tokens": 1024,
99
+ # "temperature": 0
100
  }
101
  }
102
  ]
src/tools/crypto_evm_wallet_toolkit.py CHANGED
@@ -1,5 +1,4 @@
1
  import asyncio
2
- from enum import Enum
3
  from phi.tools import Toolkit
4
  from phi.utils.log import logger
5
  from src.libs.rpc_client import rpc_call
@@ -9,12 +8,13 @@ class CryptoEVMWalletTools(Toolkit):
9
  super().__init__(name="crypto_evm_wallet_tools")
10
 
11
  # Registering methods to make them accessible via the toolkit
12
- # self.register(self.get_evm_wallet_address)
13
  self.register(self.get_supported_evm_chains)
14
  self.register(self.get_evm_smart_wallet_address)
15
  self.register(self.get_evm_smart_wallet_balances)
 
 
16
 
17
- # Fetching the list of supported EVM chains
18
  self.chains = self.get_supported_evm_chains()
19
 
20
  def get_supported_evm_chains(self) -> list[str]:
@@ -32,35 +32,6 @@ class CryptoEVMWalletTools(Toolkit):
32
  params = {}
33
  response = asyncio.run(rpc_call(method_name="getEVMSupportedChains", params=params))
34
  return f"{response}"
35
-
36
- # def get_evm_wallet_address(self, user_email: str, chain: str, testnet: bool = True) -> str:
37
- # """
38
- # Fetches an EVM wallet address for the given user email and supported chain.
39
- # Creates and returns an EVM wallet address for the given user email and supported chain.
40
-
41
- # Parameters:
42
- # - user_email (str): The email of the user for whom the wallet is being created.
43
- # - chain (ethereum | binance | base | polygon): The EVM chain for which the wallet is being fetched.
44
- # - testnet (bool, optional): A flag indicating whether the wallet should be on the testnet. Defaults to `True`.
45
-
46
- # Returns:
47
- # - str: A string representation of the response from the RPC call.
48
-
49
- # Raises:
50
- # None
51
-
52
- # Note:
53
- # This method uses asyncio.run() to run the asynchronous RPC call.
54
- # """
55
- # logger.info(f"Creating crypto wallet account for {user_email}")
56
-
57
- # params = {
58
- # 'chain': chain,
59
- # 'testnet': testnet,
60
- # 'userEmail': user_email,
61
- # }
62
- # response = asyncio.run(rpc_call(method_name="getEVMWallet", params=params))
63
- # return f"{response}"
64
 
65
  def get_evm_smart_wallet_address(
66
  self,
@@ -99,6 +70,34 @@ class CryptoEVMWalletTools(Toolkit):
99
  response = asyncio.run(rpc_call(method_name="getEVMSmartWallet", params=params))
100
  return f"{response}"
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  def get_evm_smart_wallet_balances(
103
  self,
104
  address: str,
@@ -134,3 +133,31 @@ class CryptoEVMWalletTools(Toolkit):
134
  }
135
  response = asyncio.run(rpc_call(method_name="getEVMSmartWalletAddressBalances", params=params))
136
  return f"{response}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import asyncio
 
2
  from phi.tools import Toolkit
3
  from phi.utils.log import logger
4
  from src.libs.rpc_client import rpc_call
 
8
  super().__init__(name="crypto_evm_wallet_tools")
9
 
10
  # Registering methods to make them accessible via the toolkit
 
11
  self.register(self.get_supported_evm_chains)
12
  self.register(self.get_evm_smart_wallet_address)
13
  self.register(self.get_evm_smart_wallet_balances)
14
+ self.register(self.get_all_evm_smart_wallet_address)
15
+ self.register(self.get_all_evm_smart_wallet_balances)
16
 
17
+ # Fetch the list of supported EVM chains
18
  self.chains = self.get_supported_evm_chains()
19
 
20
  def get_supported_evm_chains(self) -> list[str]:
 
32
  params = {}
33
  response = asyncio.run(rpc_call(method_name="getEVMSupportedChains", params=params))
34
  return f"{response}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  def get_evm_smart_wallet_address(
37
  self,
 
70
  response = asyncio.run(rpc_call(method_name="getEVMSmartWallet", params=params))
71
  return f"{response}"
72
 
73
+ def get_all_evm_smart_wallet_address(
74
+ self,
75
+ user_email: str,
76
+ testnet: bool = True
77
+ ) -> str:
78
+ """
79
+ Fetches all EVM smart wallet addresses for a user.
80
+
81
+ This method takes a user's email and an optional testnet flag, constructs the
82
+ necessary parameters, and makes a remote procedure call (RPC) to fetch all EVM
83
+ smart wallet addresses associated with the user.
84
+
85
+ Args:
86
+ user_email (str): The email of the user whose wallet addresses are to be fetched.
87
+ testnet (bool, optional): A flag indicating whether to fetch addresses from the testnet. Defaults to True.
88
+
89
+ Returns:
90
+ str: The response from the RPC call containing the wallet addresses.
91
+ """
92
+ logger.info(f"Fetching all crypto evm smart wallet addresses for {user_email}")
93
+
94
+ params = {
95
+ 'testnet': testnet,
96
+ 'userEmail': user_email,
97
+ }
98
+ response = asyncio.run(rpc_call(method_name="getAllEVMSmartWallets", params=params))
99
+ return f"{response}"
100
+
101
  def get_evm_smart_wallet_balances(
102
  self,
103
  address: str,
 
133
  }
134
  response = asyncio.run(rpc_call(method_name="getEVMSmartWalletAddressBalances", params=params))
135
  return f"{response}"
136
+
137
+ def get_all_evm_smart_wallet_balances(
138
+ self,
139
+ user_email: str,
140
+ testnet: bool = True
141
+ ) -> str:
142
+ """
143
+ Fetches the balances of all smart EVM wallet addresses for the given user email.
144
+
145
+ This method takes a user's email and an optional testnet flag, constructs the
146
+ necessary parameters, and makes a remote procedure call (RPC) to fetch all EVM
147
+ smart wallet addresses associated with the user.
148
+
149
+ Args:
150
+ user_email (str): The email of the user whose wallet addresses are to be fetched.
151
+ testnet (bool, optional): A flag indicating whether to fetch addresses from the testnet. Defaults to True.
152
+
153
+ Returns:
154
+ str: The response from the RPC call containing the wallet addresses.
155
+ """
156
+ logger.info(f"Fetching crypto wallet account for {user_email}")
157
+
158
+ params = {
159
+ 'testnet': testnet,
160
+ 'userEmail': user_email,
161
+ }
162
+ response = asyncio.run(rpc_call(method_name="getAllEVMSmartWalletsAddressBalances", params=params))
163
+ return f"{response}"