Skip to content

Commit

Permalink
modified airtable prompt slightly, and allowed for str to convert to …
Browse files Browse the repository at this point in the history
…dict to properly create a record
  • Loading branch information
tylerprogramming committed Jun 2, 2024
1 parent 444eb2a commit 860e363
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions integrations/airtable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import autogen
import os
import json
from dotenv import load_dotenv

from typing_extensions import Annotated
Expand Down Expand Up @@ -37,10 +38,11 @@


@user_proxy.register_for_execution()
@engineer.register_for_llm(description="Create a record in Airtable. Make sure there are no back slashes in the json.")
@engineer.register_for_llm(description="Create a record in Airtable. Make sure there are no slashes in the json.")
def create_record(record: Annotated[str, "Create the Record"], table: Annotated[str, "The table to create record in"]):
table = api.table(base_id, table)
created_record = table.create(record)
data = json.loads(record)
created_record = table.create(data)
return created_record


Expand All @@ -64,8 +66,25 @@ def get_all_records(table: Annotated[str, "The table to get records from"]):
engineer,
message="""
I need you to integrate with Airtable. Wait for my next instructions. If you are creating a record, first get the record
structure and then from that, format it into json that is needed to create a record. The record must be in json format, meaning the
keys and values are both wrapped in double quotes, not single quotes. You don't need back slashes in the json. If it's a number, you also don't need
structure and then from that, format it into json that is needed to create a record. The record must be in json format, meaning the
keys and values are both wrapped in double quotes, not single quotes. You don't need back slashes in the json. If it's a number, you also don't need
to have double quotes.
An example record to create: {"Name": "John"}
That is an example structure to create a record.
Do not start until I give a command.
""",
)











0 comments on commit 860e363

Please sign in to comment.