functions = [ { "name": "extract_document_metadata", "parameters": { "type": "object", "properties": { "methodology_type": { "type": "string", "enum": ["experimental", "observational", "review", "simulation", "mixed"] }, "dataset_source": {"type": "string"}, "primary_metric": {"type": "string"}, "year": {"type": "integer"}, "confidence_score": {"type": "number", "minimum": 0, "maximum": 1} }, "required": ["methodology_type", "dataset_source", "year"] } } ] response = openai_client.chat.completions.create( model="gpt-4-turbo", messages=messages, functions=functions, function_call={"name": "extract_document_metadata"}, temperature=0 )