forked from langchain-ai/langchainjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Azure_ML endpoint and requested changes (#7)
* Added AzureML LLM (#1) * Added azure_ml llm endpoint * Added azure_ml entrypoint * Added field check & prettified code * Fixed error string * Fixed LLM string * Added azure ml llm constants & type & example usage * Update gitignore & package.json * Added bad response check * Added comments on example * Added int test for azure ml * Added doc integration for Azure ML llm * did azureml_chat and made changes to azureml_llm * Added requested changes (#4) * Made requesed changes * Formatted --------- Co-authored-by: Vis <vishakanshanthakumar@gmail.com> --------- Co-authored-by: Vis <vishakanshanthakumar@gmail.com> Co-authored-by: Vishakan <152434517+univish@users.noreply.github.com>
- Loading branch information
1 parent
1e9707f
commit f162d65
Showing
20 changed files
with
566 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Azure Machine Learning Chat | ||
|
||
You must deploy models on Azure with the endpointUrl, apiKey, and deploymentName | ||
when creating the AzureMLChatParams to call upon later. Must import a ContentFormatter | ||
or create your own using the ChatContentFormatter interface. | ||
|
||
```typescript | ||
import { | ||
AzureMLChatParams, | ||
LlamaContentFormatter, | ||
} from "langchain/chat_models/azure_ml"; | ||
|
||
const model = new AzureMLOnlineEndpoint({ | ||
endpointUrl: "YOUR_ENDPOINT_URL", | ||
endpointApiKey: "YOUR_ENDPOINT_API_KEY", | ||
deploymentName: "YOUR_MODEL_DEPLOYMENT_NAME", | ||
contentFormatter: new LlamaContentFormatter(), | ||
}); | ||
|
||
const res = model.invoke(["Foo"]); | ||
console.log({ res }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Azure Machine Learning | ||
|
||
You must deploy models on Azure with the endpointUrl, apiKey, and deploymentName | ||
when creating the AzureMLOnlineEndpoint to call upon later. Must import a ContentFormatter | ||
or create your own using the ContentFormatter interface. | ||
|
||
```typescript | ||
import { | ||
AzureMLOnlineEndpoint, | ||
LlamaContentFormatter, | ||
} from "langchain/llms/azure_ml"; | ||
|
||
const model = new AzureMLOnlineEndpoint({ | ||
endpointUrl: "YOUR_ENDPOINT_URL", | ||
endpointApiKey: "YOUR_ENDPOINT_API_KEY", | ||
deploymentName: "YOUR_MODEL_DEPLOYMENT_NAME", | ||
contentFormatter: new LlamaContentFormatter(), | ||
}); | ||
|
||
const res = model.invoke("Foo"); | ||
console.log({ res }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
AzureMLChatOnlineEndpoint, | ||
LlamaContentFormatter, | ||
} from "langchain/chat_models/azure_ml"; | ||
|
||
const model = new AzureMLChatOnlineEndpoint({ | ||
endpointUrl: "YOUR_ENDPOINT_URL", // Or set as process.env.AZURE_ML_ENDPOINTURL | ||
endpointApiKey: "YOUR_ENDPOINT_API_KEY", // Or set as process.env.AZURE_ML_APIKEY | ||
contentFormatter: new LlamaContentFormatter(), // Only LLAMA currently supported. | ||
}); | ||
|
||
const res = model.invoke("Foo"); | ||
|
||
console.log({ res }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
AzureMLOnlineEndpoint, | ||
LlamaContentFormatter, | ||
} from "langchain/llms/azure_ml"; | ||
|
||
const model = new AzureMLOnlineEndpoint({ | ||
endpointUrl: "YOUR_ENDPOINT_URL", // Or set as process.env.AZURE_ML_ENDPOINTURL | ||
endpointApiKey: "YOUR_ENDPOINT_API_KEY", // Or set as process.env.AZURE_ML_APIKEY | ||
deploymentName: "YOUR_MODEL_DEPLOYMENT_NAME", // Or set as process.env.AZURE_ML_NAME | ||
contentFormatter: new LlamaContentFormatter(), // Or any of the other Models: GPT2ContentFormatter, HFContentFormatter, DollyContentFormatter | ||
}); | ||
|
||
const res = model.invoke("Foo"); | ||
|
||
console.log({ res }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.