Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sales: use openai workaround to avoid cloudpickle issue #212

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading