File size: 4,808 Bytes
e93b736 6771851 e93b736 5cca416 e93b736 3e65260 e93b736 6771851 e93b736 6771851 e93b736 cac9eab e93b736 4ab0d2b 6771851 e93b736 124e810 4ab0d2b e93b736 4ab0d2b 3f8aade 7cc4197 e93b736 4ab0d2b e93b736 4ab0d2b e93b736 4ab0d2b |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
import streamlit as st
import openai
import os
from tenacity import retry, wait_fixed, stop_after_attempt
# Set the OpenAI API key
openai.api_key = os.getenv("YOUR_OPENAI_API_KEY")
# Define the initial system message
initial_messages = [
{
"role": "system",
"content": """You are an AI assistant that provides highly specific investment property recommendations in Breckenridge and
Blue River, CO. Consider the user's maximum price, selected amenities, and area preferences to recommend specific neighborhoods
or intersections that would be a good fit for investment. Importantly, only recommend areas where short-term rentals are allowed
under the new law. Only recommend neigborhoods from the following list. This list contains all neighborhoods where short-term rentals are allowed:
Boulder Ridge Sub
Peak 8 Place
Glenwild sub
Twin Elk Lodge
Saw Mill Patch Townhomes
Sawmill Creek Village
Breckenridge Park Meadows Condo
Wildwood Lodge Condo
Sunset Condo
Double Eagle Condo
Four O’Clock Condo
Tyra Summit Condo #3 Mountaineer
Wedgewood Condo
Retreat Condo
Winterpoint Townhomes
Antlers Lodge Condominiums
Skyway Lodge Condo
Jenni Exchange Condo
Snider Addition
Bartlett & Shock Sub
Journal Building Condo
Ski Hill Condo
Georgia Square Condo
River Mountain Lodge Condo
Sawmill Creek Condo
Sawmill Creek Village Sub
Pine Ridge Condo
Blazing Saddles Condo
Main Street Mall Condo
Park Place Condo
Sundowner II Condos
Sundowner Condo
Cimarron Condo
One Breckenridge Place
Columbine Condo
Winterpoint Townhomes
Trails End Condo
Cedars At Breckenridge Townhomes
Der Steiermark Condo
Mountainwood Condo
Park Avenue Lofts Condo
Snodallion Condo
Timbernest Condo
Powderhorn Condo
Pine Creek Townhomes
Tannenbaum By The River
Mother Lode Condo
Base 9 Condo
Snowdrop Condo
Lance’s West Condo
Miners Candle Condo
Lift Condo
Snowspruce Condo
Inner Circle Condo
Christiana Condo
Tamarisk Condo
Village Point Townhomes At Breck
Corral At Breckenridge
Snowflake
Chimney Ridge Townhomes
Highlander Townhomes
Elk Ridge Townhomes
Kings Ridge Condo
Los Pinos
Westridge Townhomes
Westridge Cluster Homes
Tyra IV Riverbend Lodge Condo
Saddlewood condo
Timber Trail Sub
Tyra Summit Condo
Crystal Peak Lodge
One Ski Hill Place
Mountain Thunder Lodge
River Mountain Lodge Condo
Main Street Junction
Main Street Station Condo
Water House on Main Breck
Village At Breckenridge
Plaza Three Condo AKA Wetterhorn
Liftside Condo
Chateaux Condominium Hotel
Marriot Mountain Valley Lodge AKA Hotel Breckenridge
Beaver Run Condo
Bluesky Breckenridge Condo
96 Subdivision
97 South Subdivision
97 Subdivision
Aspen View
Blue Rock Springs
Bryce Estates
Clyde Lode
Coronet
Crown
Blue River Condos
Golden Crown
Lakeshore
Leap Year
Louise Placer
McCullough Gulch
Mountain View
New Eldorado
New Eldorado Townhomes
Pennsylvania Canyon
Rivershore
Royal
Sherwood Forest
Silverheels
Smith Mining Claim
Spillway
Sunny Slope
Timber Creek Estates
Timber Line
Wilderness
"""
}
]
# Add retry logic to the API call
@retry(stop=stop_after_attempt(3), wait=wait_fixed(1))
def call_openai_api(messages):
response = openai.ChatCompletion.create(
model="gpt-4",
messages=messages
)
return response
# Function to handle the chat interaction
def InvestmentPropertyFinder(max_price, amenities, bedrooms, bathrooms, square_footage, messages):
user_input = f"I'm considering buying an investment property in Breckenridge and Blue River, CO. My maximum price is {max_price}. I'm looking for these amenities: {', '.join(amenities)}. Bedrooms: {bedrooms}, Bathrooms: {bathrooms}, Square Footage: {square_footage if square_footage else 'No preference'}."
messages.append({"role": "user", "content": user_input})
response = call_openai_api(messages)
finder_reply = response.choices[0].message.content
messages.append({"role": "assistant", "content": finder_reply})
return finder_reply, messages
# Streamlit UI
st.title("Investment Property Finder in Breckenridge and Blue River, CO")
max_price = st.text_input("Maximum Price", placeholder="Enter your maximum price for the property.")
amenities = st.multiselect("Amenities", ["Close to Skiing", "Hot Tub", "Bus Route", "Parking"], default=[])
bedrooms = st.selectbox("Bedrooms", ["1", "2", "3", "4", "5+"])
bathrooms = st.selectbox("Bathrooms", ["1", "2", "3", "4", "5+"])
square_footage = st.selectbox("Square Footage", ["<1000 sqft", "1000-2000 sqft", "2000-3000 sqft", "3000-4000 sqft", "4000+ sqft"])
if st.button('Find Properties'):
messages = initial_messages.copy()
reply, updated_messages = InvestmentPropertyFinder(max_price, amenities, bedrooms, bathrooms, square_footage, messages)
st.write(reply)
|