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

Feature/openai plugins voyage #40

Merged
merged 6 commits into from
Jun 3, 2024
Merged

Conversation

dockhardman
Copy link
Owner

No description provided.

- Add voyageai dependency
- Upgrade various dependencies including:
  - anthropic to 0.28.0
  - anyio to 4.4.0
  - certifi to 2024.6.2
  - coverage to 7.5.3
  - google-api-python-client to 2.131.0
  - google-cloud-aiplatform to 1.53.0
  - huggingface-hub to 0.23.2
  - jiter to 0.4.1
  - openai to 1.30.5
  - pkginfo to 1.11.0
  - pydantic-core to 2.18.3
  - pydantic to 2.7.2
  - rapidfuzz to 3.9.3
  - requests to 2.32.3
  - sympy to 1.12.1
  - transformers to 4.41.2
  - typing-extensions to 4.12.1
  - uvicorn to 0.30.1
  - watchfiles to 0.22.0
  - zipp to 3.19.1
- Add aiolimiter, tenacity dependencies
- Add new file `languru/openai_plugins/clients/voyage.py`
- Implement `VoyageModels` class extending `OpenAIResources.Models`
  - Define supported Voyage models
  - Implement `retrieve` and `list` methods
- Implement `VoyageEmbeddings` class extending `OpenAIResources.Embeddings`
  - Implement `create` method to generate embeddings using Voyage AI client
- Implement `VoyageOpenAI` class extending `OpenAI`
  - Override `models` and `embeddings` properties with Voyage implementations
  - Initialize `voyageai.Client` in constructor
- Add new test file tests/openai_plugins/test_voyage.py
- Test retrieving a specific model by name
- Test listing available models
- Test creating embeddings for single text and list of texts
- Verify expected embedding results are returned
- Add VOYAGE_API_KEY to the list of environment variables passed to the pytest job
The `AnthropicChatCompletions` class has been updated to handle the new message stream events introduced in the anthropic library version 0.27:

- Import the new event types: `RawContentBlockDeltaEvent`, `RawContentBlockStartEvent`, `RawContentBlockStopEvent`, `RawMessageDeltaEvent`, `RawMessageStartEvent`, `RawMessageStopEvent`, `RawMessageStreamEvent`, `TextDelta`
- Update `generator_generate_content_chunks` method to process the new event types:
  - Handle `RawMessageStartEvent` to set chat completion ID and input token count
  - Handle `RawContentBlockDeltaEvent` with `TextDelta` to yield chat completion chunks
  - Handle `RawMessageDeltaEvent` to update output token count and determine finish reason
  - Log warnings for unhandled event types
- Update poetry dependencies to require anthropic library version greater than 0.27
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 87.80488% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 79.69%. Comparing base (40e1403) to head (14e7f5c).

Files Patch % Lines
languru/openai_plugins/clients/anthropic.py 81.08% 7 Missing ⚠️
languru/openai_plugins/clients/voyage.py 93.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   79.52%   79.69%   +0.17%     
==========================================
  Files          71       72       +1     
  Lines        3213     3290      +77     
==========================================
+ Hits         2555     2622      +67     
- Misses        658      668      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dockhardman dockhardman merged commit 73eb9d9 into master Jun 3, 2024
3 checks passed
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.

None yet

1 participant