This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
highest_reviews(user_prompt, Tags, Metadata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset = "MOVIES TITLE" | |
DATASET_NAME = "Movies Titles" | |
LLM_PROVIDER = "LangChain" | |
# import the dataset | |
movie_reviews = pd.read_csv('titles.csv') | |
movie_reviews |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initialize comet LLM | |
COMET_API_KEY = "*******" | |
PROJECT = "yolopandas" | |
PROJECT_WORKSPACE = "zenunicorn" | |
comet_llm.init(project= PROJECT, | |
api_key = COMET_API_KEY, | |
workspace= PROJECT_WORKSPACE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add your openAi Key | |
import os | |
os.environ['OPENAI_API_KEY'] = '*******' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import Yolopandas | |
from yolopandas import pd | |
# import CometLLM | |
import comet_llm |
NewerOlder