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

feat: update model_provider jina to support custom url and model #4110

Merged
merged 2 commits into from May 7, 2024

Conversation

VoidIsVoid
Copy link
Contributor

@VoidIsVoid VoidIsVoid commented May 6, 2024

Description

add jina_api_compatible to provide a method that user can add their rerank model

Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • TODO

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. ⚙️ feat:model-runtime 💪 enhancement New feature or request labels May 6, 2024
@takatost
Copy link
Collaborator

takatost commented May 7, 2024

I think we can just add the base URL and context size parameters directly on Jina Rerank, right? We can also add a switch for the context size, whether we need to customize it or not.

@VoidIsVoid
Copy link
Contributor Author

I think we can just add the base URL and context size parameters directly on Jina Rerank, right? We can also add a switch for the context size, whether we need to customize it or not.

It's a good suggues to add on jina rerank.
I think it's no need to add a switch for the context size, each model needs context size setting

@VoidIsVoid VoidIsVoid force-pushed the main branch 2 times, most recently from 703967f to 4d222c3 Compare May 7, 2024 07:45
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels May 7, 2024
@VoidIsVoid VoidIsVoid changed the title feat: add model provider jina_api_compatible feat: update model_provider jina to support custom url and model May 7, 2024
@VoidIsVoid
Copy link
Contributor Author

@takatost I have update the code, please check again, thank you

@takatost
Copy link
Collaborator

takatost commented May 7, 2024

I think we can just add the base URL and context size parameters directly on Jina Rerank, right? We can also add a switch for the context size, whether we need to customize it or not.

It's a good suggues to add on jina rerank. I think it's no need to add a switch for the context size, each model needs context size setting

You're right, I mixed up the built-in models. 😅

@takatost
Copy link
Collaborator

takatost commented May 7, 2024

@takatost I have update the code, please check again, thank you

Thanks, I'll test it later.

@takatost takatost self-requested a review May 7, 2024 08:46
@takatost
Copy link
Collaborator

takatost commented May 7, 2024

image

Looks like the parameter api_key is missing here.

@VoidIsVoid
Copy link
Contributor Author

image Looks like the parameter `api_key` is missing here.

sorry, it's forgot, I will add it later.
I find another issue, I only want to add rerank model by jina compatible api, but when i add customizable-model, text-embedding shows up, I didn't want it, cause i can add embedding model by compatible api.
Is there some how I can hide text text-embedding? Or I should revert code to first version to add rerank only.
@takatost

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 7, 2024
@takatost
Copy link
Collaborator

takatost commented May 7, 2024

image Looks like the parameter `api_key` is missing here.

sorry, it's forgot, I will add it later. I find another issue, I only want to add rerank model by jina compatible api, but when i add customizable-model, text-embedding shows up, I didn't want it, cause i can add embedding model by compatible api. Is there some how I can hide text text-embedding? Or I should revert code to first version to add rerank only. @takatost

I fixed it for you and also added custom model configuration for Embedding. 😉

Copy link
Collaborator

@takatost takatost left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 7, 2024
@VoidIsVoid
Copy link
Contributor Author

image Looks like the parameter `api_key` is missing here.

sorry, it's forgot, I will add it later. I find another issue, I only want to add rerank model by jina compatible api, but when i add customizable-model, text-embedding shows up, I didn't want it, cause i can add embedding model by compatible api. Is there some how I can hide text text-embedding? Or I should revert code to first version to add rerank only. @takatost

I fixed it for you and also added custom model configuration for Embedding. 😉

Thank you so much.

@takatost takatost merged commit 543a00e into langgenius:main May 7, 2024
7 checks passed
rennokki pushed a commit to rennokki/dify that referenced this pull request May 9, 2024
…ggenius#4110)

Co-authored-by: Gimling <huangjl@ruyi.ai>
Co-authored-by: takatost <takatost@gmail.com>
@takatost takatost mentioned this pull request May 9, 2024
evnydd0sf pushed a commit to evnydd0sf/dify that referenced this pull request May 10, 2024
…ggenius#4110)

Co-authored-by: Gimling <huangjl@ruyi.ai>
Co-authored-by: takatost <takatost@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request ⚙️ feat:model-runtime lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants