[log_activity_posthog]

pull/299/head
Kye 1 year ago
parent cdca44c96f
commit b3aa321c46

@ -1,9 +1,7 @@
from swarms.models.gemini import Gemini
# Initialize the model
model = Gemini(
gemini_api_key="A",
)
model = Gemini()
# Establish the prompt and image
task = "What is your name"

@ -1,15 +1,3 @@
"""
Paid
# TODO: Pass in abstract LLM class that can utilize Hf or Anthropic models, Move away from OPENAI
# TODO: ADD Universal Communication Layer, a ocean vectorstore instance
# TODO: BE MORE EXPLICIT ON TOOL USE, TASK DECOMPOSITION AND TASK COMPLETETION AND ALLOCATION
# TODO: Add RLHF Data collection, ask user how the swarm is performing
# TODO: Create an onboarding process if not settings are preconfigured like `from swarms import Swarm, Swarm()` => then initiate onboarding name your swarm + provide purpose + etc
"""
import asyncio
from abc import ABC
from concurrent.futures import ThreadPoolExecutor, as_completed

@ -9,22 +9,13 @@ from swarms.telemetry.user_utils import generate_unique_identifier
load_dotenv()
# Initialize Posthog client
def init_posthog(debug: bool = True, *args, **kwargs):
"""Initialize Posthog client.
# # Initialize Posthog client
api_key = os.getenv("POSTHOG_API_KEY")
host = os.getenv("POSTHOG_HOST")
posthog = Posthog(api_key, host=host)
posthog.debug = True
Args:
debug (bool, optional): Whether to enable debug mode. Defaults to True.
"""
api_key = os.getenv("POSTHOG_API_KEY")
host = os.getenv("POSTHOG_HOST")
posthog = Posthog(api_key, host=host, *args, **kwargs)
if debug:
posthog.debug = True
return posthog
# return posthog
def log_activity_posthog(event_name: str, **event_properties):
@ -55,7 +46,7 @@ def log_activity_posthog(event_name: str, **event_properties):
distinct_user_id = generate_unique_identifier()
# Capture the event
init_posthog.capture(
posthog.capture(
distinct_user_id, event_name, event_properties
)
@ -66,13 +57,13 @@ def log_activity_posthog(event_name: str, **event_properties):
return decorator_log_activity
@log_activity_posthog(
"function_executed", function_name="my_function"
)
def my_function():
# Function logic here
return "Function executed successfully!"
# @log_activity_posthog(
# "function_executed", function_name="my_function"
# )
# def my_function():
# # Function logic here
# return "Function executed successfully!"
out = my_function()
print(out)
# out = my_function()
# print(out)

Loading…
Cancel
Save