Sviluppare sistemi di AI con l'API di OpenAI
Francesca Donadoni
Curriculum Manager, DataCamp
"Stiamo cercando un Data Scientist esperto per unirsi al nostro team innovativo presso la sede di San Francisco, CA. In questo ruolo lavorerai su analisi dati e modelli complessi che guidano le nostre decisioni strategiche. Requisiti: almeno 3 anni di esperienza in data science con Python e AWS, Azure o GCP."
from openai import OpenAI client = OpenAI(api_key="ENTER YOUR KEY HERE") response= client.chat.completions.create( model="gpt-4o-mini", messages=messages,tools=function_definition,)
function_definition = [{'type': 'function','function': {'name': 'extract_job_info', 'description': 'Get the job information from the body of the input text', 'parameters': { ...}}]
function_definition = [{ 'type': 'function', 'function': { 'name': 'extract_job_info', 'description': 'Get the job information from the body of the input text','parameters': {'type': 'object', 'properties': 'job': {'type': 'string', 'description': 'Job title'}, 'location': {'type': 'string', 'description': 'Office location'}, ... }}]
response= client.chat.completions.create( model="gpt-4o-mini", messages=messages, tools=function_definition )print(response.choices[0].message.tool_calls[0].function.arguments)
{"job":"Data Scientist","location":"San Francisco, CA"}
Sviluppare sistemi di AI con l'API di OpenAI