LONGYKING commited on
Commit
9ed1d29
·
1 Parent(s): 6e04ea8

added assiatant instruction

Browse files
chatxbt-assistant.py CHANGED
@@ -15,6 +15,7 @@ from src.tools.crypto_evm_wallet_toolkit import CryptoEVMWalletTools
15
  from src.tools.user_profile_toolkit import UserProfileToolkit
16
  from phi.storage.assistant.postgres import PgAssistantStorage
17
  from src.knowledge_bases.combined import knowledge_base
 
18
 
19
  storage = PgAssistantStorage(
20
  # stores runs in the ai.assistant_runs table
@@ -84,8 +85,12 @@ async def set_starters():
84
  async def start():
85
  is_dev_mode = True if os.getenv("DEV_MODE") else False
86
 
 
 
87
  # Initialize the assistant
88
  cxbt_assistant = Assistant(
 
 
89
  llm=OpenAIChat(model="gpt-4o"),
90
  tools=[
91
  UserProfileToolkit(),
 
15
  from src.tools.user_profile_toolkit import UserProfileToolkit
16
  from phi.storage.assistant.postgres import PgAssistantStorage
17
  from src.knowledge_bases.combined import knowledge_base
18
+ from src.config.assistant import description, instruction
19
 
20
  storage = PgAssistantStorage(
21
  # stores runs in the ai.assistant_runs table
 
85
  async def start():
86
  is_dev_mode = True if os.getenv("DEV_MODE") else False
87
 
88
+ print(instruction)
89
+
90
  # Initialize the assistant
91
  cxbt_assistant = Assistant(
92
+ description=description,
93
+ instruction=instruction,
94
  llm=OpenAIChat(model="gpt-4o"),
95
  tools=[
96
  UserProfileToolkit(),
src/config/assistant.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ description = """
2
+ You are ChatXBT,
3
+ a web3 assistant developed and equipped to assist users with answering web3 questions,
4
+ web3 research, providing web3 solutions, and carrying out any web3-related tasks.
5
+ """
6
+
7
+ instruction = [
8
+ """
9
+ Scope of Conversation:
10
+ - This conversation is exclusively within the context and scope of web3,
11
+ decentralized finance (DeFi), blockchain technology, and cryptocurrency ecosystems.
12
+ """,
13
+ """
14
+ Handling Non-Related Queries:
15
+ - For any conversation outside the scope or context of web3, DeFi, blockchain technology,
16
+ or cryptocurrencies, inform the user that you are trained to assist only within the mentioned scopes above and provide a standard response.
17
+ - Standard response for out-of-scope queries: I'm sorry, but I can only assist with questions and tasks related to web3, decentralized finance (DeFi), blockchain technology, and cryptocurrencies.
18
+ """
19
+ ]
src/libs/rpc_client.py CHANGED
@@ -27,9 +27,9 @@ async def rpc_call(
27
  httpx.RequestError: If an error occurs while making the RPC call.
28
 
29
  """
30
- headers = {
31
  'Content-Type': 'application/json',
32
- "Authorization": os.getenv('CHATXBT_RPC_SERVER_BASIC_AUTH_CREDENTIALS')
33
  }
34
 
35
  payload = {
 
27
  httpx.RequestError: If an error occurs while making the RPC call.
28
 
29
  """
30
+ headers ={
31
  'Content-Type': 'application/json',
32
+ "authorization": f'Basic {os.getenv('CHATXBT_RPC_SERVER_BASIC_AUTH_CREDENTIALS')}'
33
  }
34
 
35
  payload = {
src/tools/user_profile_toolkit.py CHANGED
@@ -18,7 +18,7 @@ class UserProfileToolkit(Toolkit):
18
  self.register(self.update_user_picture)
19
 
20
  @cl.on_chat_start
21
- def get_user_info(self, info_type: str) -> str:
22
  """
23
  Fetches user information from the Chainlit user session.
24
 
 
18
  self.register(self.update_user_picture)
19
 
20
  @cl.on_chat_start
21
+ def get_user_info(self, info_type: str = "name") -> str:
22
  """
23
  Fetches user information from the Chainlit user session.
24