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 first version of IBM BAM support #222

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Add first version of IBM BAM support #222

merged 1 commit into from
Jan 15, 2024

Conversation

geoand
Copy link
Collaborator

@geoand geoand commented Jan 12, 2024

No description provided.

@geoand geoand force-pushed the watsonx branch 4 times, most recently from 373a81e to fbd44e1 Compare January 12, 2024 18:09
@geoand geoand changed the title WIP - Add experimental Watsonx repo Add first version of IBM Watsonx support Jan 12, 2024
@geoand geoand marked this pull request as ready for review January 12, 2024 18:10
@geoand geoand requested a review from a team as a code owner January 12, 2024 18:10
@andreadimaio
Copy link
Contributor

Hi @geoand , I'm looking at the code that you are writing to implement the watsonx module in the quarkus-langchain4j extension, and from the defaults in the Langchain4jWatsonxConfig.java and ChatModelConfig.java I understand that the BAM APIs are your starting point.

This could be a problem because the API endpoint that you are calling in the WatsonxChatModel.java class, the v2/text/chat, is not present in watsonx. So if you change the base URL in application.properties to switch from BAM to watsonx you will get an exception [404].

The correct url to call should be ml/v1-beta/generation/text which is very similar to the text generation API in BAM.

This is what I understood by reading some of the online documentation and trying the free version of the watsonx product.
I hope this could be useful for what you are doing 😃

@andreadimaio
Copy link
Contributor

andreadimaio commented Jan 14, 2024

Another two differences are:

  • To call a REST Api you need to create a project, each project has a project_id and this must be passed as a parameter in the request body.

  • Authentication requires an intermediate step. From an API Key you need to generate an IAM Token (valid for 60 minutes) which is used to execute the REST API call.

Maybe using the BAM APIs as a starting point is not so good because from my understanding there are differences that don't allow your code to be used for both products.

@cescoffier
Copy link
Collaborator

I guess we need to rename in into bam instead of watsonx.

@andreadimaio
Copy link
Contributor

If your idea is to integrate the BAM APIs into the quarkus-langchain4j extension, I could contribute with my code.
The only thing you need to know is that the BAM API is for internal use only, which means that the new module cannot be used by the entire Quarkus community.

@geoand
Copy link
Collaborator Author

geoand commented Jan 15, 2024

Thanks for the input @andreadimaio!

So maybe we should just keep this as for us to be able to experiment with BAM is and not merge it?

@cescoffier
Copy link
Collaborator

cescoffier commented Jan 15, 2024 via email

@geoand geoand changed the title Add first version of IBM Watsonx support Add first version of IBM BAM support Jan 15, 2024
@geoand
Copy link
Collaborator Author

geoand commented Jan 15, 2024

PR updated to replace all occurences of watsonx with bam

@geoand geoand merged commit ecb9a72 into main Jan 15, 2024
1 of 2 checks passed
@geoand geoand deleted the watsonx branch January 15, 2024 08:53
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