Skip to content

Commit

Permalink
sales: use openai workaround to avoid cloudpickle issue (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
masenf committed Feb 26, 2024
1 parent 9739d8d commit a139ab7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chakra_apps/sales/sales/sales.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

from .models import Customer

client = OpenAI()
_client = OpenAI()

def client():
return _client

products = {
"T-shirt": {
"description": "A plain white t-shirt made of 100% cotton.",
Expand Down Expand Up @@ -110,7 +114,7 @@ async def call_openai(self):
location: str = self.generate_email_data["location"]
job: str = self.generate_email_data["job"]
salary: int = self.generate_email_data["salary"]
response = client.completions.create(
response = client().completions.create(
model="gpt-3.5-turbo-instruct",
prompt=f"Based on these {products} write a sales email to {name} adn email {email} who is {age} years old and a {gender} gender. {name} lives in {location} and works as a {job} and earns {salary} per year. Make sure the email reccomends one product only and is personalized to {name}. The company is named Reflex its website is https://reflex.dev",
temperature=0.7,
Expand Down

0 comments on commit a139ab7

Please sign in to comment.