Bagoodex-Web-Search / test_api.py
abdibrokhim's picture
search for images, videos, links, and follow up questions working nice
5058660
raw
history blame
784 Bytes
import requests
from openai import OpenAI
import os
from dotenv import load_dotenv
load_dotenv()
# Insert your AIML API Key instead of <YOUR_API_KEY>:
API_KEY = os.getenv("AIML_API_KEY")
API_URL = 'https://api.aimlapi.com'
# Call the standart chat completion endpoint to get an ID
def _complete_chat():
client = OpenAI(
base_url=API_URL,
api_key=API_KEY,
)
response = client.chat.completions.create(
model="bagoodex/bagoodex-search-v1",
messages=[
{
"role": "user",
# Enter your query here
"content": 'how to make a slingshot',
},
],
)
print(response.choices[0].message.content)
# Run the function
# _complete_chat()