File size: 767 Bytes
40ae8d6 |
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 36 |
import torch
import os
# Load the Falcon 7B model
from openai import OpenAI
import streamlit as st
def decode(hotel_description, query):
client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
prompt = f"""
this is the hotel descriptoin:
\"{hotel_description}\"
and these are my requirements
\"{query}\"
now tell me why the hotel might be a good fit for me given the requirements, make it consise.
"""
stream = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompt}],
stream=True,
)
str = ""
for chunk in stream:
if chunk.choices[0].delta.content is not None:
str += (chunk.choices[0].delta.content)
return str
|