-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.py
32 lines (22 loc) · 857 Bytes
/
common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import investor_agent
import inspect
import google.cloud.logging
from gemini_agents_toolkit import agent
import investor_agent
from google.oauth2 import service_account
import vertexai
vertexai.init(project="gemini-trading-backend", location="us-west1")
MODEL_NAME="gemini-1.5-flash-002"
GCP_PROJECT = "gemini-trading-backend"
GCP_CREDENTAILS = service_account.Credentials.from_service_account_file(
'./sa.json')
logging_client = google.cloud.logging.Client(project=GCP_PROJECT, credentials=GCP_CREDENTAILS)
logging_client.setup_logging()
def create_client(user_id, on_message_received):
return investor_agent.create_agent(
model_name=MODEL_NAME,
debug=True,
add_scheduling_functions=True,
gcs_bucket="gemini_jobs",
gcs_blob=f"jobs_{user_id}.json",
on_message=on_message_received)