Skip to content

Commit

Permalink
First try
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoLoz12 committed May 18, 2024
1 parent 1cab256 commit c9bcca9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions app/utils/whatsapp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from flask import current_app, jsonify
import json
import requests

# from app.services.openai_service import generate_response
from app.services.openai_service import generate_response
import re


Expand Down Expand Up @@ -86,8 +85,8 @@ def process_whatsapp_message(body):
response = generate_response(message_body)

# OpenAI Integration
# response = generate_response(message_body, wa_id, name)
# response = process_text_for_whatsapp(response)
#response = generate_response(message_body, wa_id, name)
#response = process_text_for_whatsapp(response)

data = get_text_message_input(current_app.config["RECIPIENT_WAID"], response)
send_message(data)
Expand Down
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

example.env
# This token expires after 24 hours. You can get a new one from the your Meta App Dashboard > API Setup
# Or you can create an access token at the System User level from the Meta Business Settings: https://business.facebook.com/settings/system-users

Expand Down
3 changes: 1 addition & 2 deletions start/assistants_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def upload_file(path):

file = upload_file("../data/airbnb-faq.pdf")


# --------------------------------------------------------------
# Create assistant
# --------------------------------------------------------------
Expand All @@ -29,7 +28,7 @@ def create_assistant(file):
You currently cannot set the temperature for Assistant via the API.
"""
assistant = client.beta.assistants.create(
name="WhatsApp AirBnb Assistant",
name="WhatsApp Carmesi Assistant",
instructions="You're a helpful WhatsApp assistant that can assist guests that are staying in our Paris AirBnb. Use your knowledge base to best respond to customer queries. If you don't know the answer, say simply that you cannot help with question and advice to contact the host directly. Be friendly and funny.",
tools=[{"type": "retrieval"}],
model="gpt-4-1106-preview",
Expand Down
4 changes: 2 additions & 2 deletions start/whatsapp_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def send_message(data):


data = get_text_message_input(
recipient=RECIPIENT_WAID, text="Hello, this is a test message."
recipient=RECIPIENT_WAID, text="Hello, this is a test message from Carmesi."
)

response = send_message(data)
Expand Down Expand Up @@ -131,7 +131,7 @@ def get_text_message_input(recipient, text):


data = get_text_message_input(
recipient=RECIPIENT_WAID, text="Hello, this is a test message."
recipient=RECIPIENT_WAID, text="Hello, this is a test message Krmsi."
)

loop = asyncio.get_event_loop()
Expand Down

0 comments on commit c9bcca9

Please sign in to comment.