< Back to examples

Invoice Entity Extraction

Given an invoice, the model is able to extract the named entities in the contract

Input

Given a banking invoice, please return the name of the vendor.

Bank Invoice: PURCHASE #0521 MERCHANT ALLBIRDS ACC XXX3846
Vendor: ALLBIRDS

--

Bank Invoice: PURCHASE #6781 MERCHANT SHOPPERS ACC XXX9877
Vendor: SHOPPERS

--

Bank Invoice: PURCHASE #0777 CN TOWER ACC XXX3846
Vendor:

Sample Response

CN TOWER

API Request

1import cohere
2co = cohere.Client('{apiKey}')
3response = co.generate(
4  model='base',
5  prompt='Given a banking invoice, please return the name of the vendor.\n\nBank Invoice: PURCHASE #0521 MERCHANT ALLBIRDS ACC XXX3846\nVendor: ALLBIRDS\n--\nBank Invoice: PURCHASE #6781 MERCHANT SHOPPERS ACC XXX9877\nVendor: SHOPPERS\n--\nBank Invoice: PURCHASE #0777 CN TOWER ACC XXX3846\nVendor:',
6  max_tokens=15,
7  temperature=0.3,
8  k=0,
9  p=1,
10  frequency_penalty=0,
11  presence_penalty=0,
12  stop_sequences=["--"],
13  return_likelihoods='NONE')
14print('Prediction: {}'.format(response.generations[0].text))

Parameters

model_sizebase
presence_penalty 0
stop_sequence --
max_tokens 15
temperature 0.3
k 0
frequency_penalty 0
p 1