|
import openai |
|
import requests |
|
|
|
def interpret_prompt(prompt): |
|
|
|
response = openai.ChatCompletion.create( |
|
model="gpt-4", |
|
messages=[{"role": "user", "content": prompt}] |
|
) |
|
return response.choices[0].message['content'] |
|
|
|
def post_to_erp(accounting_entry): |
|
|
|
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) |
|
result = post_to_erp(accounting_entry) |
|
print(result) |