Salesforce Open LLM Connector to watsonx.ai.
This repository contains instructions on how to setup or connect to an IBM API Connect based connector that translates Salesforce Open LLM Connector specification to watsonx.ai API calls. There are 2 options to use the connector.
-
A multi-tenant connector is already hosted on an IBM API Connect instance on IBM Cloud. It should be used only for PoC and testing. The API calls may be limited, and no high availability or performance guarantees are provided. This should not be used for production.
Use the following URL to connect to the hosted service. Substitute the
projectid
andregion
parameters based on your watsonx.ai instance.https://dsce-apico-12e7a051-gateway-dsce-apiconnect.dsce-ocp-us-south-1-bx2-1-8516f8a0a0d756a8a5eb1ab83a990b56-0000.us-south.containers.appdomain.cloud/dsce-apic/sandbox?projectid=<your-wx-project-id>®ion=<your-wx-region>
Note: The hosted connector link may change over time. Please check for the latest URL on this page.
-
Use the code and instructions in this repo to setup your own connector on an IBM API Connect instance.
code folder contains the connector code files.
-
apic-converter.yml: API design flow exported from IBM API Connect.
-
gatewayscript: folder contains javascript code logic for transformation that is used in API Connect GatewayScript policy.
- transform_queryparams.js: logic to extract query parameters from the request and set them in context variables.
- compl_request.js & compl_response.js: logic to transform the request & response payload for
/completions
endpoint. - chat_compl_request.js & chat_compl_response.js: logic to transform the request & response payload for
/chat/completions
endpoint. - embed_request.js & embed_response.js: logic to transform the request & response payload for
/embeddings
endpoint.
resources folder contains resource documents.
- llm-open-connector.yml: The connector code is built using this version of the Salesforce Open LLM Connector specification.
- api-parameters-mapping.pdf: The documentation for mapping parameters from Salesforce Open LLM Connector specification to watsonx.ai API specification.
-
Pre-requisites:
- An IBM API Connect SaaS / Software instance. Get a free trial.
Note: The current hosted connector uses IBM API Connect software version 10.0.6.0
- A watsonx.ai instance on IBM cloud (get a watsonx trial account).
- An IBM API Connect SaaS / Software instance. Get a free trial.
-
In IBM API Connect manager, add a new API.
-
Import the Salesforce Open LLM Connector specification as shown here.
-
Switch to 'Source' view.
-
Replace the full source with the content provided in
code/apic-converter.yml
file. -
'Save' the changes.
-
Make the API online.
-
Go to 'Test' tab on the UI to test the API.
Alternatively, use
code/test-connection.js
file from your local machine to test the API.node test-connection.js
-
API Connect is configured with some default properties as shown here.
-
Create a new connection to watsonx.ai model from your Salesforce Einstein Studio using a recipe.