https://www.boundaryml.com logo
🟡 Question on merging JSON records for Ticker add...
# questions
r
I have a question about a LARGE join of 10K small JSON records and 20-100 simple records. Is this possible? This is me trying to do Ticker addition to companies in one pass 🙂
Copy code
class TickerList {
  tickers Ticker[]
}

function AddTickersToCompanies(company_list: CompanyList, ticker_list: TickerList) -> CompanyList {
  // see clients.baml
  client Gemini20Flash

  // The prompt uses Jinja syntax. Change the models or this text and watch the prompt preview change!
  prompt #"
    Examine the following sets of companies and tickers and match the tickers with the companies based on their names representing the same entity. Merge the matched records, adding a Ticker to each Company that matches. If the company name in the ticker differs from the company name, use the full corporate name.

    Return a set of companies with tickers merged into the ticker field.

    {# special macro to print the output instructions. #}
    {{ ctx.output_format(hoist_classes=["Company", "Ticker", "CompanyList"]) }}

    {{ _.role("user") }}

    Company List: {{ company_list }}
    Ticker List: {{ ticker_list }}
  "#
}
10K record Ticker data:
Copy code
{"0":{"cik_str":789019,"ticker":"MSFT","title":"MICROSOFT CORP"},"1":{"cik_str":1045810,"ticker":"NVDA","title":"NVIDIA CORP"},"2":{"cik_str":320193,"ticker":"AAPL","title":"Apple Inc."},"3":{"cik_str":1018724,"ticker":"AMZN","title":"AMAZON COM INC"},"4":{"cik_str":1652044,"ticker":"GOOGL","title":"Alphabet Inc."}
Company data:
Copy code
{
  "uuid": "9a173b89-3dad-4f74-887f-33d60a53a83f",
  "url": "https://www.datacenterdynamics.com/en/news/gpu-cloud-boost-run-plans-to-go-public-via-de-spac-merger/",
  "name": "Willow Lane Acquisition Corp.",
  "description": "Willow Lane Acquisition Corp. is a blank check company formed for the purpose of effecting a merger, amalgamation, share exchange, asset acquisition, share purchase, reorganization, or similar business combination with one or more businesses.",
  "ceo": "Luke Weil"
}
One question I have is how I can load the record in a BAML test... I'd rather just test there than Python.
a
Isn't this easier to do in Python? Seems purely algorithmic
a
ooo im curious -- what makes you want to test in BAML vs python?
we dont yet have the ability to load from a text file into a BAML test! sorry about that!