File size: 761 Bytes
634769d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import openai
import requests
def interpret_prompt(prompt):
# Call GPT model
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}]
)
return response.choices[0].message['content']
def post_to_erp(accounting_entry):
# Example Odoo API call
url = "https://your-odoo-instance/api/account.move"
headers = {"Authorization": "Bearer YOUR_TOKEN"}
response = requests.post(url, json=accounting_entry, headers=headers)
return response.json()
prompt = "Received $245 from Tylor Smith today"
interpretation = interpret_prompt(prompt)
accounting_entry = map_to_journal_entry(interpretation) # You define this mapping
result = post_to_erp(accounting_entry)
print(result) |