<#1617 Add ChatGPT-powered `openai` and `extract` ...
# meltano-repo-activity
g
#1617 Add ChatGPT-powered
openai
and
extract
function tos
stream_maps
Pull request opened by DouweM on <!date^1681748874^{date_short}|2023-04-17T16:27:54Z> Example config: tap-gmail plugins: extractors: - name: tap-gmail variant: kgpayne pip_url: git+https://github.com/DouweM/tap-gmail.git@latest-python config: oauth_credentials: client_id: $GOOGLE_CLIENT_ID client_secret: $GOOGLE_CLIENT_SECRET refresh_token: $GOOGLE_REFRESH_TOKEN user_id: me messages: q: label:order-notification-receipt -from:me newer_than:14d select: - messages.id - messages.parsed - messages.parsed.* - '!messages.parsed.body.html' mappers: - name: meltano-map-transformer variant: meltano pip_url: git+https://github.com/DouweM/meltano-map-transform.git@openai config: stream_map_config: openai_api_key: $OPENAI_API_KEY mappings: - name: map-receipts config: stream_maps: receipts: __source__: messages id: id date: parsed["date"] provider: > extract( parsed["body"]["text"], "name of the service provider", key="provider", examples=list("Uber", "Uber Eats", "Rappi", "Amazon") ) amount: > float( extract( parsed["body"]["text"], "total amount paid", "a floating point number", key="amount", examples=list(1234.56, 101.10, 0.99) ) ) currency: > extract( parsed["body"]["text"], "currency", "3-letter code inferred from the text, the language, and referenced locations", examples=list("EUR", "MXN", "USD") ) vendor: > extract( parsed["body"]["text"], "name of the vendor (if it's an order, the restaurant or store; if it's a trip, the service provider)", key="vendor", examples=list( "Tortas del Fuego", "Michi Ramen (S Lamar)", "Uber", "Turbo" ) ) service: > extract( parsed["body"]["text"], "a short description of the provided service starting with the name of the service provider (if it's an order, include only the product names or vendor or delivery address; if it's a trip, include only the pickup and dropoff locations)", key="service", examples=list( "Uber from 'Terminal 2, Aeropuerto Internacional de la Ciudad de Mexico (MEX)' to 'Calle Amsterdam 123, Ciudad de Mexico'", "Uber from 'Calle Constituyente Echanove 123' to 'Calle Amsterdam 123, Ciudad de Mexico'", "Uber Eats to Calle Amsterdam 123, Ciudad de Mexico", "Rappi: Torta de Chilaquiles", "Rappi: Chau Fan Vegetariano, Verduras Mixtas con Fideo de Soya, Chau Mein Vegetariano, Camarones Empanizados", "Rappi from Av Sonora 205, Colonia Condesa, Ciudad de Mexico, CDMX, Mexico" ) ) __else__: __else__: Use as: meltano run tap-gmail map-receipts target-foo Example output: id: <id> date: 2023-04-21T123456 provider: Uber Eats amount: 34.56 currency: USD vendor: Shake Shack service: Uber Eats to <address> --- 📚 Documentation preview 📚: https://meltano-sdk--1617.org.readthedocs.build/en/1617/ meltano/sdk ✅ All checks have passed 1/1 successful checks