-
Notifications
You must be signed in to change notification settings - Fork 21
Add Anthropic Claude provider #55
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates a new Anthropic Claude provider into Neural, including code, Vim integration, documentation, and tests.
- Introduce Python implementation for Anthropic Claude with streaming completion and error handling.
- Add Vimscript defaults and source registration for Anthropic, plus corresponding Vader tests.
- Update documentation and add comprehensive Python and Vim tests.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
test/vim/test_config.vader | Added a Vader test for default Anthropic config |
test/vim/test_anthropic.vader | Added a Vader test for the Anthropic source dictionary |
test/python/test_anthropic.py | Added unit tests for config loading, streaming, and errors |
neural_providers/anthropic.py | New Anthropic Claude provider implementation |
autoload/neural/source/anthropic.vim | Vimscript function for Anthropic source |
autoload/neural/config.vim | Added default Anthropic settings to config |
doc/neural.txt | Updated TOC and added Anthropic Claude docs |
Comments suppressed due to low confidence (1)
test/python/test_anthropic.py:49
- [nitpick] The test name
test_main_function_rate_other_error
is misleading—it tests generic HTTP errors, not rate-limit errors. Renaming to something liketest_main_function_other_http_error
would improve clarity.
def test_main_function_rate_other_error() -> None:
role: Optional[str] = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable role
is declared but never used in get_claude_completion
. Consider removing it to reduce dead code.
role: Optional[str] = None |
Copilot uses AI. Check for mistakes.
role: Optional[str] = None | ||
|
||
context = ( | ||
ssl._create_unverified_context() # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Bypassing SSL verification on Darwin can expose MITM risks. Consider using a verified context or clearly documenting the trusted use case.
ssl._create_unverified_context() # type: ignore | |
ssl.create_default_context() |
Copilot uses AI. Check for mistakes.
except Exception: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching all Exceptions is too broad. Narrow the exception to json.JSONDecodeError
or KeyError
to avoid masking unexpected errors.
except Exception: | |
pass | |
except json.JSONDecodeError: | |
pass | |
except KeyError: | |
pass |
Copilot uses AI. Check for mistakes.
Summary
Testing
python -m pytest -q
https://chatgpt.com/codex/tasks/task_b_6851b9c702008323ae60f3e7a6ff4d6e