Skip to content

Instantly share code, notes, and snippets.

View zenUnicorn's full-sized avatar
💭
Hello, am a software developer, hook me up for a gig

Shittu olumide zenUnicorn

💭
Hello, am a software developer, hook me up for a gig
View GitHub Profile
def movie_occurence(user_prompt, tags, metadata):
comet_llm.log_prompt(
prompt = user_prompt,
tags = tags,
metadata = metadata,
output = user_prompt
)
user_prompt = prompt_with_cost
# To get the actualy running cost
from yolopandas.utils.query_helpers import run_query_with_cost
prompt_with_cost = run_query_with_cost(movie_reviews, "Show how many times the movie tile 'The Gift' occurs in the dataset", yolo=True)
highest_reviews(user_prompt, Tags, Metadata)
def highest_reviews(user_prompt, tags, metadata):
comet_llm.log_prompt(
prompt = user_prompt,
tags = tags,
metadata = metadata,
output = user_prompt
)
user_prompt = highest_reviews_prompt
highest_reviews_prompt = movie_reviews.llm.query("for each movie, count the number of reviews and their average score. Show the 5 with the highest reviews,", yolo=True)
dataset = "MOVIES TITLE"
DATASET_NAME = "Movies Titles"
LLM_PROVIDER = "LangChain"
# import the dataset
movie_reviews = pd.read_csv('titles.csv')
movie_reviews
# Log a full prompt and response
comet_llm.log_prompt(
prompt="What is this conversation about?",
metadata= {
"usage.prompt_tokens": 7,
"usage.completion_tokens": 5,
"usage.total_tokens": 12,
"output.index": 0,
"output.logprobs": None,
# initialize comet LLM
COMET_API_KEY = "*******"
PROJECT = "yolopandas"
PROJECT_WORKSPACE = "zenunicorn"
comet_llm.init(project= PROJECT,
api_key = COMET_API_KEY,
workspace= PROJECT_WORKSPACE)
# Add your openAi Key
import os
os.environ['OPENAI_API_KEY'] = '*******'
# import Yolopandas
from yolopandas import pd
# import CometLLM
import comet_llm