Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Angelchev
Copy link
Member

Summary

  • implement a new Anthropic Claude provider
  • expose Anthropic source in Vim
  • include default Anthropic settings
  • document the Anthropic provider
  • test the new provider in Python and Vim

Testing

  • python -m pytest -q

https://chatgpt.com/codex/tasks/task_b_6851b9c702008323ae60f3e7a6ff4d6e

@Angelchev Angelchev requested a review from Copilot June 17, 2025 19:02
Copy link

@Copilot Copilot AI left a 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 like test_main_function_other_http_error would improve clarity.
def test_main_function_rate_other_error() -> None:

Comment on lines +64 to +65
role: Optional[str] = None

Copy link
Preview

Copilot AI Jun 17, 2025

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.

Suggested change
role: Optional[str] = None

Copilot uses AI. Check for mistakes.

role: Optional[str] = None

context = (
ssl._create_unverified_context() # type: ignore
Copy link
Preview

Copilot AI Jun 17, 2025

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.

Suggested change
ssl._create_unverified_context() # type: ignore
ssl.create_default_context()

Copilot uses AI. Check for mistakes.

Comment on lines +132 to +133
except Exception:
pass
Copy link
Preview

Copilot AI Jun 17, 2025

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.

Suggested change
except Exception:
pass
except json.JSONDecodeError:
pass
except KeyError:
pass

Copilot uses AI. Check for mistakes.

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

Successfully merging this pull request may close these issues.

1 participant