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

llms: extract common llms errors to shared declaration #925

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

wgeorgecook
Copy link
Contributor

PR Checklist

  • Read the Contributing documentation.
  • Read the Code of conduct documentation.
  • Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
  • Describes the source of new concepts.
  • References existing implementations as appropriate.
  • Contains test coverage for new functions.
  • Passes all golangci-lint checks.

This addresses the comment Travis made in this PR I previously made. It specifically extracts the ErrorIncompleteEmbedding error and the ErrorEmptyResponse error used in the files in the /llms directory.

I specifically targeted these errors because they're the ones I encountered using LangChain Go, there is still more work to be done in consolidating all of the other potentially shared errors.

@wgeorgecook
Copy link
Contributor Author

Looks like the ci lint wasn't run before these files made it into main. I'm working on fixing them all now.

@wgeorgecook
Copy link
Contributor Author

CI is now passing.

@wgeorgecook
Copy link
Contributor Author

@tmc I resolved conflicts with main for this and ensured that the linter is happy in the /llms directory. Let me know if you want to take this in a different direction but I think this is a good start towards centralizing these error messages.

@tmc
Copy link
Owner

tmc commented Sep 13, 2024

Thanks so much, this ia great to see.

llms/errors.go Outdated
import "errors"

var (
// ErrEmptyResponse is thrown when an LLM returns an empty response.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"thrown" isn't exactly the right language in Go,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmc Fair. I'll change it to "is returned"

@tmc tmc requested a review from eliben September 13, 2024 00:12
@tmc
Copy link
Owner

tmc commented Sep 13, 2024

I wonder if llms is the right place to put the errors, I don't love the new source dependency on what is already a pretty large package implies. I don't have a better suggestion. @eliben do you have an opinion here?

@wgeorgecook
Copy link
Contributor Author

@tmc I have the same concern. It feels weird to have a root level errors package since the exported types are directly related to the LLMs. But it doesn't have to be. But it would probably also feel weird to have a root level errors package with just any and all exported errors in it. Very open to suggestions.

@eliben
Copy link
Collaborator

eliben commented Sep 16, 2024

I wonder if llms is the right place to put the errors, I don't love the new source dependency on what is already a pretty large package implies. I don't have a better suggestion. @eliben do you have an opinion here?

I don't see the advantage of this approach - what's the motivation here? How are llm-unique errors going to be represented?

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

Successfully merging this pull request may close these issues.

3 participants