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

Fixes regarding notebooks #29

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/core_docs/docs/integrations/llms/ibm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@
"\n",
"const props = {\n",
" decoding_method: \"sample\",\n",
" max_new_tokens: 100,\n",
" min_new_tokens: 1,\n",
" maxNewTokens: 100,\n",
" minNewTokens: 1,\n",
" temperature: 0.5,\n",
" top_k: 50,\n",
" top_p: 1,\n",
" topK: 50,\n",
" topP: 1,\n",
"};\n",
"const instance = new WatsonxLLM({\n",
" version: \"YYYY-MM-DD\",\n",
Expand Down Expand Up @@ -298,7 +298,7 @@
"source": [
"const result2 = await instance.invoke(\"Print hello world.\", {\n",
" parameters: {\n",
" max_new_tokens: 20,\n",
" maxNewTokens: 100,\n",
" },\n",
"});\n",
"console.log(result2);"
Expand Down
4 changes: 1 addition & 3 deletions docs/core_docs/docs/integrations/text_embedding/ibm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
" serviceUrl: process.env.API_URL,\n",
" projectId: \"<PROJECT_ID>\",\n",
" spaceId: \"<SPACE_ID>\",\n",
" idOrName: \"<DEPLOYMENT_ID>\",\n",
" model: \"<MODEL_ID>\",\n",
"});"
]
Expand All @@ -175,7 +174,7 @@
"source": [
"Note:\n",
"\n",
"- You must provide `spaceId`, `projectId` or `idOrName`(deployment id) in order to proceed.\n",
"- You must provide `spaceId` or `projectId` in order to proceed.\n",
"- Depending on the region of your provisioned service instance, use correct serviceUrl."
]
},
Expand Down Expand Up @@ -278,7 +277,6 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 11,
"id": "2f4d6e97",
"metadata": {},
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-community/src/llms/ibm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {

export interface WatsonxCallOptionsLLM extends BaseLanguageModelCallOptions {
maxRetries?: number;
parameters?: WatsonxInputLLM;
parameters?: Partial<WatsonxInputLLM>;
idOrName?: string;
}

Expand Down
12 changes: 12 additions & 0 deletions libs/langchain-community/src/llms/tests/ibm.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ describe("Text generation", () => {
await watsonXInstance.invoke("Hello world?");
});

test("Overwritte params", async () => {
const watsonXInstance = new WatsonxLLM({
model: "ibm/granite-13b-chat-v2",
version: "2024-05-31",
serviceUrl: process.env.WATSONX_AI_SERVICE_URL as string,
projectId: process.env.WATSONX_AI_PROJECT_ID,
});
await watsonXInstance.invoke("Hello world?", {
parameters: { maxNewTokens: 10 },
});
});

test("Invalid projectId", async () => {
const watsonXInstance = new WatsonxLLM({
model: "ibm/granite-13b-chat-v2",
Expand Down
Loading