docs: add Microsoft Azure to ChatModelTabs (#22367)

Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
Qingchuan Hao 2024-06-03 22:19:00 +08:00 committed by GitHub
parent ed8e9c437a
commit 3e92ed8056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View File

@ -104,7 +104,7 @@
"```\n", "```\n",
"## Preview\n", "## Preview\n",
"\n", "\n",
"In this guide well build a QA app over as website. The specific website we will use isthe [LLM Powered Autonomous\n", "In this guide well build a QA app over as website. The specific website we will use is the [LLM Powered Autonomous\n",
"Agents](https://lilianweng.github.io/posts/2023-06-23-agent/) blog post\n", "Agents](https://lilianweng.github.io/posts/2023-06-23-agent/) blog post\n",
"by Lilian Weng, which allows us to ask questions about the contents of\n", "by Lilian Weng, which allows us to ask questions about the contents of\n",
"the post.\n", "the post.\n",

View File

@ -20,6 +20,7 @@ import CodeBlock from "@theme-original/CodeBlock";
* @property {boolean} [hideMistral] - Whether or not to hide Mistral chat model. * @property {boolean} [hideMistral] - Whether or not to hide Mistral chat model.
* @property {boolean} [hideGoogle] - Whether or not to hide Google VertexAI chat model. * @property {boolean} [hideGoogle] - Whether or not to hide Google VertexAI chat model.
* @property {boolean} [hideTogether] - Whether or not to hide Together chat model. * @property {boolean} [hideTogether] - Whether or not to hide Together chat model.
* @property {boolean} [hideAzure] - Whether or not to hide Microsoft Azure OpenAI chat model.
* @property {string} [customVarName] - Custom variable name for the model. Defaults to `model`. * @property {string} [customVarName] - Custom variable name for the model. Defaults to `model`.
*/ */
@ -35,6 +36,7 @@ export default function ChatModelTabs(props) {
mistralParams, mistralParams,
googleParams, googleParams,
togetherParams, togetherParams,
azureParams,
hideOpenai, hideOpenai,
hideAnthropic, hideAnthropic,
hideCohere, hideCohere,
@ -42,6 +44,7 @@ export default function ChatModelTabs(props) {
hideMistral, hideMistral,
hideGoogle, hideGoogle,
hideTogether, hideTogether,
hideAzure,
customVarName, customVarName,
} = props; } = props;
@ -57,7 +60,10 @@ export default function ChatModelTabs(props) {
const googleParamsOrDefault = googleParams ?? `model="gemini-pro"`; const googleParamsOrDefault = googleParams ?? `model="gemini-pro"`;
const togetherParamsOrDefault = const togetherParamsOrDefault =
togetherParams ?? togetherParams ??
`\n base_url="https://api.together.xyz/v1",\n api_key=os.environ["TOGETHER_API_KEY"],\n model="mistralai/Mixtral-8x7B-Instruct-v0.1",`; `\n base_url="https://api.together.xyz/v1",\n api_key=os.environ["TOGETHER_API_KEY"],\n model="mistralai/Mixtral-8x7B-Instruct-v0.1",\n`;
const azureParamsOrDefault =
azureParams ??
`\n azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],\n azure_deployment=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"],\n openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],\n`;
const llmVarName = customVarName ?? "model"; const llmVarName = customVarName ?? "model";
@ -80,6 +86,15 @@ export default function ChatModelTabs(props) {
default: false, default: false,
shouldHide: hideAnthropic, shouldHide: hideAnthropic,
}, },
{
value: "Azure",
label: "Azure",
text: `from langchain_openai import AzureChatOpenAI\n\n${llmVarName} = AzureChatOpenAI(${azureParamsOrDefault})`,
apiKeyName: "AZURE_OPENAI_API_KEY",
packageName: "langchain-openai",
default: false,
shouldHide: hideAzure,
},
{ {
value: "Google", value: "Google",
label: "Google", label: "Google",