Spaces:
Runtime error
Runtime error
File size: 784 Bytes
5058660 21ffffb 5058660 21ffffb 5058660 21ffffb 5058660 21ffffb 5058660 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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() |