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

Add suport for Anthropic model #39

Open
branhoff opened this issue May 6, 2024 · 0 comments
Open

Add suport for Anthropic model #39

branhoff opened this issue May 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@branhoff
Copy link
Collaborator

branhoff commented May 6, 2024

Description:
Currently, our car diagnostic application supports using OpenAI's GPT models for generating diagnostic responses. However, we would like to enhance the application to also support Anthropic's language models, such as Claude, to provide more flexibility and options for our users.

Desired Functionality

  • Extend the llm_interaction module to support Anthropic's language models and embeddings.
  • Update the get_llm and get_embeddings functions to handle the "anthropic" provider based on environment variables.
  • Modify the get_context function in the util.py module to conditionally create the agent_executor based on the selected LLM type (OpenAI or Anthropic).
  • Ensure proper error handling and fallback mechanisms when using Anthropic models.

Implementation Details

  1. Add the langchain_anthropic package to the requirements.txt

  2. Update the llm_interaction module:

    • Import the necessary classes from langchain_anthropic, such as ChatAnthropic and AnthropicEmbeddings.
    • Modify the get_llm function to return a ChatAnthropic instance when the LLM_TYPE environment variable is set to "anthropic".
    • Modify the get_embeddings function to return an AnthropicEmbeddings instance when the EMBEDDINGS_TYPE environment variable is set to "anthropic".
  3. Update the get_context function in the util.py module:

    • Check the LLM_TYPE environment variable to determine the selected LLM type.
    • If LLM_TYPE is set to "anthropic", create the agent_executor without specifying the agent parameter to avoid passing unsupported arguments.
    • For other LLM types (e.g., OpenAI), create the agent_executor with the agent parameter set to "openai-functions".
  4. Update the unit tests in tests/test_llm_interaction.py to include test cases for Anthropic models and embeddings.

  5. Update the application's documentation and README to reflect the added support for Anthropic models and provide instructions on how to configure the environment variables for using Anthropic.

Benefits

  • Increased flexibility and choice for users by supporting both OpenAI and Anthropic models.
  • Potential performance improvements and enhanced language understanding by leveraging Anthropic's state-of-the-art models like Claude.
  • Ability to compare and evaluate the performance of different LLMs within the application.

Considerations

  • Ensure that the application handles any differences in API responses and error messages between OpenAI and Anthropic models gracefully.
  • Verify that the Anthropic integration does not introduce any breaking changes or negatively impact the existing functionality.
  • Consider any additional costs or resource requirements associated with using Anthropic's services.
@branhoff branhoff added the enhancement New feature or request label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant