Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Merchant #6

Open
seem2810 opened this issue Aug 1, 2024 · 1 comment
Open

Problems with Merchant #6

seem2810 opened this issue Aug 1, 2024 · 1 comment

Comments

@seem2810
Copy link

seem2810 commented Aug 1, 2024

I've got an error:

HelgeSverre\ReceiptScanner\Data\Merchant::__construct(): Argument #3 ($address) must be of type ?string, array given, called in vendor/helgesverre/receipt-scanner/src/Data/Receipt.php on line 34

What can I do to fix this?

@HelgeSverre
Copy link
Owner

As this is driven by "AI Magic" there is no way to 100% fix issues like this.

But you can try the following:

  • Reduce the temperature.
  • Switch to another model, the readme does not mention it, but all new models from OpenAI should be supported as long as they support JSON mode.
  • Publish the prompts and tweak them for your use-case (Ex: add the line "If there are multiple addresses, only return one as an object" or something like that)

If none of that works, you can do your own post-processing of the data by returning the receipt data as an array.

By default this package tries to pass the extracted data into a DTO, so if the data does not adhere to the DTO structure, it will fail/throw, which is usually the desired behaviour, rather than getting invalid data.

Let me know if any of these tips help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants