Files
ds_sabaproject/__pycache__/names_collection.cpython-311.pyc
T

67 lines
5.8 KiB
Plaintext
Raw Normal View History

2024-11-13 00:41:30 +01:00
§
2024-11-27 20:44:26 +01:00
:à4gjãó,ddlmZddlZddlZddlmZddlmZddlm Z ddl
2024-11-13 00:41:30 +01:00
m Z ddl m
2024-11-27 20:44:26 +01:00
Z
2024-11-13 00:41:30 +01:00
mZddlZddlZddlmZe¦«ejd ¦«ejd <ed
¬ ¦«Zejd ¦«Zefd
ZdedefdZdefdZdefdZdS)é)ÚOpenAIN)Ú load_dotenv)Ú
ChatOpenAI)Ú TavilyClient)ÚPromptTemplate)ÚStrOutputParserÚJsonOutputParser)ÚloggerÚOPENAI_API_KEYzgpt-4o)ÚmodelÚPERPLEXITY_AI_APIcó2d}ddddœd|dœgddd d
gd d d d
d d
ddœ
}d|ddœ}tj|||¬¦«}|jdkrI| ¦«} |dd
dd}|S#tt
f$rYdSwxYwd|jS)Nz*https://api.perplexity.ai/chat/completionsz llama-3.1-sonar-huge-128k-onlineÚsystemzBe precise and concise.)ÚroleÚcontentÚusergš™™™™™É?gÍÌÌÌÌÌì?Tz
perplexity.aiFÚmonthré)
r ÚmessagesÚ temperatureÚtop_pÚreturn_citationsÚsearch_domain_filterÚ
return_imagesÚreturn_related_questionsÚsearch_recency_filterÚtop_kÚstreamÚpresence_penaltyÚfrequency_penaltyzBearer zapplication/json)Ú
Authorizationz Content-Type)ÚjsonÚheaderséÈÚchoicesÚmessagerzUnexpected response format.z!Request failed with status code: )ÚrequestsÚpostÚ status_coder"ÚKeyErrorÚ
IndexError)ÚpromptÚapi_keyÚurlÚpayloadr#ÚresponseÚ
response_dataÚmessage_contents úWc:\Users\timmy_3aupohg\Downloads\Manaknight Projects\ds_sabaproject\names_collection.pyÚperplexity_datar4sØ
6€Cð
ð
ð
Ø
ð
ð 
ðØØ Ø!0Ð 1ØØ$)Ø!(ØØØØð-ð€Gð4- 7Ðð€Gõ
Œ}˜S w¸Ð@€HðÔ˜ Ÿ
š
œˆ
ð+¨IÔ6°qÔ9¸DÀYÔOˆ "øÝ 1øøøðJ°8Ô3GÐIsÁA7Á7B  B Úinfluencer_namesÚreturncó²tjd¦«tddg¬¦«}|tzt ¦«z}| d|i¦«}|S)NzFormatting Influencer Dataaî<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a Influencer Data Extractor AI Agent tasked with extracting information from a search result
You are provided with three informations:
1. Search result of influencers names
Your job is to extract all the influencers names
Make sure to extract all the names there
You are to return this as a JSON output. The key should be 'names' in the JSON
Do not add to the search result, just return the JSON data of all the influencer names as expected.
<|eot_id|><|start_header_id|>user<|end_header_id|>
INFLUENCER_NAMEs: {influencer_names}
<|eot_id|><|start_header_id|>assistant<|end_header_id|>r5)ÚtemplateÚinput_variables)r
ÚinforÚllmr Úinvoke)r5Úinitiator_promptÚinitiator_routerÚoutputs r3Ú
extract_namesr@BsmÝ
„KÐ

ñ
ô
Ðð$(­-Õ0@Ñ0BÔ0BÑØ
×
$Ð&8Ð9IÐ%JÑ
2024-11-27 20:44:26 +01:00
K€FØ €MóÚproduct_categorycóžtjd¦«d|d}t|¦«}tjd¦«t|¦«}|S)NzSearch for influencers namesz;Give me a list of the names of the all the top and popular zŠ influencers in USA. People that are known across the internet. I only need their names. Give me all that's available as much as possible.zExtracting influencers names)r
2024-11-13 00:41:30 +01:00
r:r4r@)rBÚ names_promptÚ search_namesÚinfluencers_namess r3Úget_category_influencersrGZsbÝ
„KÐnÐQaðnðnðn€LÝ" 0€LÝ
„KÐ% lÑØ ÐrAÚproduct_categoriescó~i}tj ¦«5Šˆfd|D¦«}tj |¦«D]T}||} | ¦«}|||<Œ%#t
2024-11-27 20:44:26 +01:00
$r#}t