{"id":24822183,"url":"https://github.com/azure-samples/deepseek-azure-javascript","last_synced_at":"2025-10-13T20:31:14.129Z","repository":{"id":274976361,"uuid":"924601420","full_name":"Azure-Samples/deepseek-azure-javascript","owner":"Azure-Samples","description":"Demonstrate how to use DeepSeek-R1 models GitHub Models, Azure or Ollama","archived":false,"fork":false,"pushed_at":"2025-02-13T09:15:09.000Z","size":562,"stargazers_count":37,"open_issues_count":0,"forks_count":11,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-09-21T04:35:17.917Z","etag":null,"topics":["ai-samples","azure","azure-ai","deepseek-r1","generative-ai","javascript","langchain-js","llm","ollama","openai","sample","typescript"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azure-Samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-30T10:14:06.000Z","updated_at":"2025-08-07T03:03:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"7927b5ef-4b30-4bdf-b10e-b52dffdcb696","html_url":"https://github.com/Azure-Samples/deepseek-azure-javascript","commit_stats":null,"previous_names":["azure-samples/deepseek-azure-javascript"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Azure-Samples/deepseek-azure-javascript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fdeepseek-azure-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fdeepseek-azure-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fdeepseek-azure-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fdeepseek-azure-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azure-Samples","download_url":"https://codeload.github.com/Azure-Samples/deepseek-azure-javascript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fdeepseek-azure-javascript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016921,"owners_count":26085908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-samples","azure","azure-ai","deepseek-r1","generative-ai","javascript","langchain-js","llm","ollama","openai","sample","typescript"],"created_at":"2025-01-30T18:26:50.165Z","updated_at":"2025-10-13T20:31:14.122Z","avatar_url":"https://github.com/Azure-Samples.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"./docs/images/icon.png\" alt=\"\" align=\"center\" height=\"96\" /\u003e\n\n# DeepSeek on Azure - JavaScript demos\n\n[![Open project in GitHub Codespaces](https://img.shields.io/badge/Codespaces-Open-blue?style=flat-square\u0026logo=github)](https://codespaces.new/Azure-Samples/deepseek-azure-javascript?hide_repo_select=true\u0026ref=main\u0026quickstart=true)\n![Node version](https://img.shields.io/badge/Node.js-20+-grass?style=flat-square)\n[![TypeScript](https://img.shields.io/badge/TypeScript-blue?style=flat-square\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org)\n[![License](https://img.shields.io/badge/License-MIT-orange?style=flat-square)](LICENSE)\n\n⭐ If you like this repo, star it on GitHub — it helps a lot!\n\n[Overview](#overview) • [Get started](#get-started) • [Run the samples](#run-the-samples) • [Next steps](#next-steps) • [Related samples](#related-samples)\n\n\u003c/div\u003e\n\n## Overview\n\nDeepSeek-R1 model has been announced on [GitHub Models](https://github.blog/changelog/2025-01-29-deepseek-r1-is-now-available-in-github-models-public-preview/)\nas well as on [Azure AI Foundry](https://azure.microsoft.com/en-us/blog/deepseek-r1-is-now-available-on-azure-ai-foundry-and-github/), and\nthe goal of this collection of samples is to demonstrate how to use it with JavaScript/TypeScript, using either the [OpenAI Node.js SDK](https://github.com/openai/openai-node), [LangChain.js](https://js.langchain.com/), [LlamaIndex.TS](https://ts.llamaindex.ai/) or [Azure AI Inference SDK](https://www.npmjs.com/package/@azure-rest/ai-inference).\n\n\u003e [!TIP]\n\u003e You can run any of these demos right in your browser for free using [GitHub Codespaces](https://github.com/features/codespaces) and [GitHub Models](https://github.com/marketplace/models)! ✨\n\n\u003e [!NOTE]\n\u003e The DeepSeek-R1 model focus is on complex reasoning tasks, and it is not designed for general conversation. It is best suited for tasks that require a deep understanding of the context and a complex reasoning process to provide an answer, like the `samples/08-reasoning.ts` example.\n\u003e This also means that you may experience longer response times compared to other models, because it simulates a though process (englobed under the `\u003cthink\u003e` tag) before providing an actual answer.\n\n## Get started\n\nThere are multiple ways to get started with this project.\n\nThe quickest way is to use [GitHub Codespaces](#use-github-codespaces) that provides a preconfigured environment for you, directly from your browser. Alternatively, you can [set up your local environment](#use-your-local-environment) following the instructions below.\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003ch3\u003eUse GitHub Codespaces\u003c/h3\u003e\u003c/summary\u003e\n\nYou can run this project directly in your browser by using GitHub Codespaces, which will open a web-based VS Code:\n\n[![Open in GitHub Codespaces](https://img.shields.io/static/v1?style=flat-square\u0026label=GitHub+Codespaces\u0026message=Open\u0026color=blue\u0026logo=github)](https://codespaces.new/Azure-Samples/deepseek-azure-javascript?hide_repo_select=true\u0026ref\u0026quickstart=true)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eUse a VSCode dev container\u003c/h3\u003e\u003c/summary\u003e\n\nA similar option to Codespaces is VS Code Dev Containers, that will open the project in your local VS Code instance using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).\n\nYou will also need to have [Docker](https://www.docker.com/get-started/) installed on your machine to run the container.\n\n[![Open in Dev Containers](https://img.shields.io/static/v1?style=flat-square\u0026label=Dev%20Containers\u0026message=Open\u0026color=blue\u0026logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/deepseek-azure-javascript)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eUse your local environment\u003c/h3\u003e\u003c/summary\u003e\n\nYou need to install following tools to work on your local machine:\n\n- [Node.js LTS](https://nodejs.org/en/download)\n- [Git](https://git-scm.com/downloads)\n- [Ollama](https://ollama.com/) _(optional)_ - For using the models locally\n\nThen you can get the project code:\n\n1. [**Fork**](https://github.com/Azure-Samples/deepseek-azure-javascript/fork) the project to create your own copy of this repository.\n2. On your forked repository, select the **Code** button, then the **Local** tab, and copy the URL of your forked repository.\n\n   ![Screenshot showing how to copy the repository URL](./docs/images/clone-url.png)\n3. Open a terminal and run this command to clone the repo: `git clone \u003cyour-repo-url\u003e`\n4. Open the cloned project in your favorite IDE, then run this command in a terminal: `npm install`\n\n\u003c/details\u003e\n\n## Run the samples\n\nIn the [samples](./samples) folder of this repository, you'll find examples of how to use the DeepSeek-R1 models with different use cases and SDKs. You can run them by executing the following command in the terminal:\n\n```bash\nnpx tsx samples/\u003cfilename\u003e\n```\n\nAlternatively, you can open a sample file in the editor and run it directly by clicking the \"Run\" (▶️) button in the top right corner of the editor.\n\nThe samples are configured by default to run using GitHub models, which should run without any additional configuration if you're using GitHub Codespaces. There are multiple ways to run the samples using either GitHub Models, Azure AI Foundry or even locally using Ollama. Open the `samples/config.ts` and change the default export to the desired configuration.\n\n### Using GitHub Models\n\nTo use GitHub Models, you need to have a [GitHub account](https://github.com/signup) and a [personal access token (PAT)](https://docs.github.com/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).\n\nOnce you have created you PAT, create a `.env` file in the root of the project and add the following content:\n\n```env\nGITHUB_TOKEN=\u003cyour-github-token\u003e\n```\n\n\u003e [!TIP]\n\u003e If you're using GitHub Codespaces, you can run the samples using GitHub Models without any additional configuration.\n\u003e Codespaces already sets up the environment variables for you, and you don't need to create a PAT.\n\nOpen the `samples/config.ts` file and update the default export:\n\n```ts\nexport default GITHUB_MODELS_CONFIG;\n```\n\n### Using Azure AI Foundry\n\nTo use Azure AI Foundry, you need to have an [Azure account](https://azure.com/free). Then follow this [quickstart guide](https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-serverless?tabs=azure-ai-studio) to deploy a serverless endpoint with the model. When it's time to choose the model, select the `DeepSeek-R1` model in the catalog.\n\nOnce your endpoint is deployed, you should be able to see your endpoint details and retrieve the URL and API key:\n\n![Screenshot showing the endpoint details in Azure AI Foundry](./docs/images/ai-foundry-endpoint.png)\n\nThen create a `.env` file in the root of the project and add the following content:\n\n```env\nAZURE_AI_BASE_URL=\"https://\u003cyour-deployment-name\u003e.\u003cregion\u003e.models.ai.azure.com/v1\"\nAZURE_AI_API_KEY=\"\u003cyour-api-key\u003e\"\n```\n\n\u003e [!TIP]\n\u003e If you're copying the endpoint from the Azure AI Foundry portal, make sure to add the `/v1` at the end of the URL.\n\nOpen the `samples/config.ts` file and update the default export:\n\n```ts\nexport default AZURE_AI_CONFIG;\n```\n\n### Using Ollama\n\nTo use Ollama, you first need to use a [local dev environment](#use-your-local-environment) and install [Ollama](https://ollama.com/). Then, open a terminal and use the Ollama CLI to download the [DeepSeek-R1 model](https://ollama.com/library/deepseek-r1):\n\n```bash\nollama pull deepseek-r1:14b\n```\n\n\u003e [!TIP]\n\u003e Different model sizes are [available](https://ollama.com/library/deepseek-r1), you can pick the one that fits your needs.\n\u003e Larger models will provide better results but will require more resources to run. You can switch the model used by example by editing the `samples/config.ts` file.\n\nOnce the model is downloaded, open the `samples/config.ts` file and update the default export:\n\n```ts\nexport default OLLAMA_CONFIG;\n```\n\n## Next steps\n\nHere are some additional resources to help you learn more and experiment with generative AI on Azure:\n- [How to use DeepSeek-R1 reasoning model](https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-deepseek?pivots=programming-language-javascript) (Microsoft Learn): a tutorial to learn how to use the DeepSeek-R1 reasoning model.\n- [Azure AI Foundry](https://ai.azure.com/) (Azure): a web portal to create, train, deploy and experiment with AI models.\n- [Generative AI with JavaScript](https://github.com/microsoft/generative-ai-with-javascript) (GitHub): code samples and resources to learn Generative AI with JavaScript.\n- [Fundamentals of Responsible Generative AI](https://learn.microsoft.com/training/modules/responsible-generative-ai/) (Microsoft Learn): a training module to learn about the responsible use of generative AI.\n- [Build a serverless AI chat with RAG using LangChain.js](https://techcommunity.microsoft.com/t5/apps-on-azure-blog/build-a-serverless-ai-chat-with-rag-using-langchain-js/ba-p/4111041) (GitHub): a next step code example to build an AI chatbot using Retrieval-Augmented Generation and LangChain.js.\n\n## Related samples\n\n- [DeepSeek-R1 JavaScript starter](https://github.com/Azure-Samples/deepseek-js)\n- [DeepSeek-R1 on Azure with LangChain4j demo](https://github.com/Azure-Samples/DeepSeek-on-Azure-with-LangChain4j)\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazure-samples%2Fdeepseek-azure-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazure-samples%2Fdeepseek-azure-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazure-samples%2Fdeepseek-azure-javascript/lists"}