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

community: add reka chat model integration #27379

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

findalexli
Copy link

community: add Reka chat model integration

Description: This PR adds support for the Reka chat model to the LangChain community package. It includes the implementation of ChatReka class, which allows users to interact with Reka's API for chat completions. The integration supports both text and image inputs, streaming responses, and async operations.

Dependencies: This integration inside langchain-community requires the reka-api package to be installed. Users will need to install it separately with pip install reka-api.

Added features:

ChatReka class for interacting with Reka chat models
Support for text and image inputs
Streaming and non-streaming response handling
Synchronous and asynchronous methods
Unit and integration tests
Example notebook demonstrating usage
Testing:

Unit tests have been added in tests/unit_tests/chat_models/test_reka.py
Integration tests have been added in tests/integration_tests/chat_models/test_reka.py
An example notebook has been created in docs/docs/integrations/chat/reka.ipynb, including tool use with search.
I have run make format, make lint, and make test from the root of the community package, and all checks pass.

X/Twitter handle: @RekaAILabs

Copy link

vercel bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ❌ Failed (Inspect) Nov 15, 2024 2:40pm

@findalexli findalexli marked this pull request as ready for review October 15, 2024 22:27
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. community Related to langchain-community labels Oct 15, 2024
@efriis
Copy link
Member

efriis commented Oct 16, 2024

closing as duplicate of #26405 - let me know if they're different

@efriis efriis closed this Oct 16, 2024
@efriis efriis reopened this Oct 16, 2024
@efriis
Copy link
Member

efriis commented Oct 16, 2024

nvm - got it - personal branch

@efriis efriis mentioned this pull request Oct 16, 2024
@efriis efriis self-assigned this Oct 16, 2024
@efriis
Copy link
Member

efriis commented Oct 16, 2024

looks like CI might still be failing though

@findalexli
Copy link
Author

HI @vbarda we made some updates and have addressed all of your comments (including notebook, token count, duplicated class, system role). Added a patch in the test_import that were the source failing the ci test. Run lint and format. Thanks!

@vbarda
Copy link
Contributor

vbarda commented Nov 6, 2024

HI @vbarda we made some updates and have addressed all of your comments (including notebook, token count, duplicated class, system role). Added a patch in the test_import that were the source failing the ci test. Run lint and format. Thanks!

Thanks! Looks like there are a few things failing (due to missing tiktoken dependency)

@findalexli
Copy link
Author

Updated to address the token count comment. thanks for the feedback. I have ran make lint, make lint and make test, and make extended_tests which passed.

Copy link
Contributor

@vbarda vbarda left a comment

Choose a reason for hiding this comment

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

looks good to me -- thanks for addressing! i think one lint issue remaining and should be good to merge

@@ -329,11 +330,29 @@ async def _agenerate(

return ChatResult(generations=[ChatGeneration(message=message)])

def get_num_tokens(self, text: str) -> int:
def get_num_tokens(self, input: Union[str, BaseMessage, List[BaseMessage]]) -> int:
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like the input type here is not matching the one in the token_counter callable (failing linter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

3 participants