import requests
def demo_call(
company,
model="gpt-4o-mini",
token="KEYWORDSAI_API_KEY"
):
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}',
}
data = {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is " + company + "'s 2024 revenue? Base your answer on the following trusted data: \n\n{% if linkup_search_response %}{{ linkup_search_response.results }}{% else %}I don't have that information.{% endif %}}"
}
],
"linkup_params": {
"apiKey": "LINKUP_API_KEY",
"q": "What is " + company + "'s 2024 revenue?",
"depth": "deep",
"outputType": "searchResults",
"includeImages": False
},
"model": "gpt-4o-mini"
}
response = requests.post('https://api.keywordsai.co/api/chat/completions', headers=headers, json=data)
return response
input_text = "Microsoft"
response = demo_call(input_text)
print(response.json())