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

[Tidy] Use BaseChatModel for type hint #550

Merged
merged 2 commits into from
Jun 27, 2024
Merged

Conversation

lingyielia
Copy link
Contributor

@lingyielia lingyielia commented Jun 27, 2024

Description

Motivation:
when adding optional model families, in current setting, LLM_MODELS value varies based on import result

try:
    from langchain_anthropic import ChatAnthropic
except ImportError:
    ChatAnthropic=None

if ChatAnthropic in not None:
    LLM_MODELS = Union[ChatOpenAI, ChatAnthropic]

Use the parent class of all langchain supported chat models
Then we don't need this lines of code:

# TODO add new wrappers in if new model support is added
LLM_MODELS = Union[ChatOpenAI]

if ChatAnthropic in not None:
    LLM_MODELS = Union[ChatOpenAI, ChatAnthropic]

Screenshot

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:37 — with GitHub Actions Inactive
@lingyielia lingyielia changed the title Use BaseChatModel for type hint [Tidy] Use BaseChatModel for type hint Jun 27, 2024
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 04:40 — with GitHub Actions Inactive
@lingyielia lingyielia marked this pull request as ready for review June 27, 2024 04:43
@lingyielia lingyielia enabled auto-merge (squash) June 27, 2024 04:47
@lingyielia lingyielia self-assigned this Jun 27, 2024
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 04:56 — with GitHub Actions Inactive
@lingyielia lingyielia disabled auto-merge June 27, 2024 04:59
@lingyielia lingyielia requested a review from antonymilne June 27, 2024 11:26
@lingyielia lingyielia force-pushed the tidy/use_basechatmodel branch from db40c94 to d2887fc Compare June 27, 2024 11:29
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 11:29 — with GitHub Actions Inactive
@lingyielia lingyielia force-pushed the tidy/use_basechatmodel branch from d2887fc to 49ea238 Compare June 27, 2024 13:12
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:12 — with GitHub Actions Inactive
@lingyielia lingyielia force-pushed the tidy/use_basechatmodel branch from 49ea238 to c285589 Compare June 27, 2024 13:51
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 13:51 — with GitHub Actions Inactive
@lingyielia lingyielia force-pushed the tidy/use_basechatmodel branch from c285589 to fd2e16d Compare June 27, 2024 16:48
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to circleci_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia temporarily deployed to vizro_ai_secrets June 27, 2024 16:48 — with GitHub Actions Inactive
@lingyielia lingyielia merged commit 38353ca into main Jun 27, 2024
36 checks passed
@lingyielia lingyielia deleted the tidy/use_basechatmodel branch June 27, 2024 17:02
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.

3 participants