{"id":133550,"date":"2025-04-30T15:32:35","date_gmt":"2025-04-30T12:32:35","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=133550"},"modified":"2025-04-30T15:32:38","modified_gmt":"2025-04-30T12:32:38","slug":"spring-ai-deepseek-cot-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html","title":{"rendered":"Spring AI DeepSeek COT Example"},"content":{"rendered":"<p>In recent years, artificial intelligence (AI) has become one of the most powerful tools for automating tasks and enhancing user experiences. One of the most popular applications of AI is chatbots, which are used to simulate human-like conversations and assist with various tasks. Whether it\u2019s customer support, information retrieval, or automated interaction, chatbots can make a significant impact. Let us delve into understanding how Spring AI integrates with DeepSeek COT to build powerful AI-driven applications.<\/p>\n<h2><a name=\"section-1\"><\/a>1. Overview of Spring AI and Deepseek?<\/h2>\n<h3>1.1 What is Spring AI?<\/h3>\n<p><a href=\"https:\/\/spring.io\/projects\/spring-ai\" target=\"_blank\" rel=\"noopener\">Spring AI<\/a> is part of the broader Spring ecosystem, which has been a go-to platform for enterprise Java applications for years. With the rise of machine learning (ML) and AI, Spring AI was developed to make it easier to integrate machine learning models into Spring Boot applications. Spring AI is designed to handle the complexities of AI\/ML workflows while keeping things simple for developers familiar with the Spring framework.<\/p>\n<p>Unlike other frameworks that require extensive configurations or complex pipelines, Spring AI provides a straightforward approach to deploying models into production environments. It supports integration with popular machine-learning tools and services, allowing you to work with models directly from your Spring Boot application.<\/p>\n<p>Spring AI also offers seamless support for deploying, serving, and interacting with AI models. The Spring Boot framework itself is known for its ease of use and speed, and with Spring AI, you can integrate AI capabilities quickly and efficiently.<\/p>\n<h4>1.1.1 Key features of Spring AI<\/h4>\n<ul>\n<li>Seamless Integration with Spring Boot: Spring AI allows for smooth integration with existing Spring Boot applications, reducing the time and effort required to add machine learning functionalities.<\/li>\n<li>Model Deployment and Serving: You can deploy pre-trained models, serve them through APIs, and integrate them into your application with minimal code.<\/li>\n<li>Support for Popular ML Frameworks: Spring AI supports integration with popular machine learning frameworks such as TensorFlow, PyTorch, and more.<\/li>\n<li>Real-time Inference: Spring AI makes it easy to perform real-time inference for use cases like chatbots, personalized recommendations, and more.<\/li>\n<\/ul>\n<h3>1.2 What is DeepSeek?<\/h3>\n<p>DeepSeek is an AI-powered platform designed for natural language processing (NLP) and conversational AI. It provides pre-trained models capable of handling complex tasks like text generation, sentiment analysis, question answering, and chatbot interactions. DeepSeek has made it easier for developers to integrate sophisticated AI models into applications without the need for deep expertise in machine learning.<\/p>\n<p>DeepSeek\u2019s models are trained on vast datasets, enabling them to generate accurate responses to user input. This makes DeepSeek an excellent choice for building chatbots and virtual assistants. The platform offers APIs that allow developers to interact with these models programmatically, making integration into web and mobile applications seamless.<\/p>\n<p>Before we proceed with integrating DeepSeek into a Spring Boot application, you\u2019ll need to generate an API key from DeepSeek. Here\u2019s how you can do that:<\/p>\n<h4>1.1.1 How to Generate a DeepSeek API Key?<\/h4>\n<ul>\n<li>Visit DeepSeek\u2019s Website: Navigate to <a href=\"https:\/\/deepseek.com\" target=\"_blank\" rel=\"noopener\">DeepSeek.com<\/a> and sign up for an account if you don&#8217;t already have one. If you do, simply log in.<\/li>\n<li>Navigate to the API Section: After logging in, go to the &#8216;API&#8217; section of your account dashboard. This is where you\u2019ll be able to generate an API key.<\/li>\n<li>Generate the API Key: Click on the button that says \u2018Generate API Key.\u2019 A new key will be created that you can use to authenticate your requests to DeepSeek&#8217;s API.<\/li>\n<li>Copy and Store Your API Key: Once generated, copy the API key. It is crucial to store it securely, as it will be used in your application to access the models.<\/li>\n<\/ul>\n<p>Once you have the API key, you\u2019ll be able to use it to interact with DeepSeek&#8217;s models, sending them text input and receiving model-generated responses.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2><a name=\"section-2\"><\/a>2. Code Example<\/h2>\n<p>Now that we have the necessary background information on Spring AI and DeepSeek, it\u2019s time to dive into the implementation. Below is a step-by-step guide to building the chatbot application using Spring Boot and the DeepSeek API.<\/p>\n<h3>2.1 Setting Up Spring Boot<\/h3>\n<p>The first step in building your Spring Boot application is to set up the project. We&#8217;ll start by adding the necessary dependencies to the <code>pom.xml<\/code> file. If you haven\u2019t created a Spring Boot project yet, you can do so via Spring Initializr or manually in your IDE.<\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;dependencies&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;spring-boot-starter-json&lt;\/artifactId&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;spring-web&lt;\/artifactId&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;spring-boot-starter-webflux&lt;\/artifactId&gt;\n\t&lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n<\/pre>\n<h3>2.2 Setting Up application.properties<\/h3>\n<p>To keep our code clean, secure, and flexible, it&#8217;s a good practice to move configuration parameters, like the DeepSeek API Key and API endpoint URL, into the <code>application.properties<\/code> file. This file is located in the <code>src\/main\/resources\/<\/code> directory of your Spring Boot project.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\"># DeepSeek API configuration\ndeepseek.api.url=https:\/\/api.deepseek.com\/chatbot\ndeepseek.api.key=your-deepseek-api-key-here\n\n# Server configuration (optional)\nserver.port=8080\n<\/pre>\n<h3>2.3 Create the Service Layer<\/h3>\n<p>In this step, we will create a service class that will handle communication with the DeepSeek API. The service class will contain the logic to make HTTP requests to the DeepSeek API, send user input, and process the response.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">@Service\npublic class ChatbotService {\n\n\t@Value(\"${deepseek.api.url}\")\n\tprivate String apiUrl;\n\n\t@Value(\"${deepseek.api.key}\")\n\tprivate String apiKey;\n\n\t@Autowired\n\tprivate RestTemplate restTemplate;\n\n\tpublic String getResponseFromDeepSeek(String userMessage) {\n\t\t\/\/ Create request body\n\t\tMap&lt;String, String&gt; requestBody = new HashMap&lt;&gt;();\n\t\trequestBody.put(\"model\", \"deepseek-chat\");\n\t\trequestBody.put(\"message\", userMessage);\n\t\trequestBody.put(\"api_key\", apiKey);\n\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\n\t\tHttpEntity&lt;Map&lt;String, String&gt;&gt; requestEntity = new HttpEntity&lt;&gt;(requestBody, headers);\n\n\t\t\/\/ Send POST request to DeepSeek API\n\t\tResponseEntity&lt;String&gt; response = restTemplate.exchange(\n\t\t\t\tapiUrl, HttpMethod.POST, requestEntity, String.class);\n\n\t\treturn response.getBody();\n\t}\n}\n<\/pre>\n<h4>2.3.1 Code Explanation<\/h4>\n<p>The <code>ChatbotService<\/code> class is a Spring service component that communicates with the DeepSeek AI API. It uses the <code>@Value<\/code> annotation to inject the DeepSeek API URL and API Key from the <code>application.properties<\/code> file, promoting clean and configurable code. The class autowires a <code>RestTemplate<\/code> to perform HTTP operations. Inside the <code>getResponseFromDeepSeek<\/code> method, it constructs a request body as a map containing the user&#8217;s message and the API key, sets the appropriate HTTP headers with <code>Content-Type: application\/json<\/code>, and then creates an <code>HttpEntity<\/code> that wraps both the body and headers. It sends a POST request to the DeepSeek API using the <code>RestTemplate.exchange()<\/code> method, passing the API URL, HTTP method, request entity, and expected response type. Finally, it returns the body of the API response, which typically contains the chatbot&#8217;s generated reply. This design cleanly separates configuration from logic, handles HTTP communication robustly, and follows Spring Boot best practices.<\/p>\n<h3>2.4 Controller to Handle User Input<\/h3>\n<p>Next, we\u2019ll create a REST controller to handle user input. This controller will accept user messages, pass them to the service layer, and return the chatbot\u2019s response.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">@RestController\n@RequestMapping(\"\/chat\")\npublic class ChatController {\n\n\t@Autowired\n\tprivate ChatbotService chatbotService;\n\n\t@PostMapping(\"\/sendMessage\")\n\tpublic String chat(@RequestBody String userMessage) {\n\t\treturn chatbotService.getResponseFromDeepSeek(userMessage);\n\t}\n}\n<\/pre>\n<h4>2.4.1 Code Explanation<\/h4>\n<p>The <code>ChatController<\/code> class is a Spring REST controller that handles incoming HTTP requests for the chatbot application. It is annotated with <code>@RestController<\/code> to indicate that it will handle RESTful web services and with <code>@RequestMapping(\"\/chat\")<\/code> to prefix all its endpoints with &#8220;\/chat&#8221;. The controller injects an instance of <code>ChatbotService<\/code> using <code>@Autowired<\/code> for accessing the chatbot logic. The <code>chat()<\/code> method is mapped to a POST endpoint &#8220;\/sendMessage&#8221; using <code>@PostMapping<\/code>. It accepts the user&#8217;s message as the request body, passes this message to the <code>getResponseFromDeepSeek()<\/code> method of the service layer, and returns the chatbot&#8217;s response directly as a plain String. This structure cleanly separates the controller from the service logic, making the code modular, readable, and maintainable.<\/p>\n<h3>2.5 Running the Application<\/h3>\n<p>Once you have completed the above steps, you can run your Spring Boot application. You can test it by sending POST requests to the <code>\/chat\/sendMessage<\/code> endpoint. Below is an example of how to interact with the API using Postman or any other HTTP client:<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">POST http:\/\/localhost:8080\/chat\/sendMessage\nContent-Type: application\/json\nBody:\n{\n\t\"message\": \"Hello, how are you?\"\n}\n<\/pre>\n<p>Upon sending this request, you will receive a response generated by the DeepSeek AI model, such as:<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">{\n\t\"response\": \"Hello! I'm an AI chatbot. How can I assist you today?\"\n}\n<\/pre>\n<h2><a name=\"section-3\"><\/a>3. Conclusion<\/h2>\n<p>Building an AI chatbot using DeepSeek models integrated with Spring AI provides a powerful and flexible solution for automating interactions and improving user engagement. By leveraging the simplicity of Spring Boot and the advanced capabilities of DeepSeek, we can create a conversational agent that understands and responds to user input in a human-like manner.<\/p>\n<p>AI chatbots are a critical component of modern digital platforms, and with tools like Spring AI and DeepSeek, building and deploying them has never been easier.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In recent years, artificial intelligence (AI) has become one of the most powerful tools for automating tasks and enhancing user experiences. One of the most popular applications of AI is chatbots, which are used to simulate human-like conversations and assist with various tasks. Whether it\u2019s customer support, information retrieval, or automated interaction, chatbots can make &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[3462,2764],"class_list":["post-133550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-ollama","tag-spring-ai"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring AI DeepSeek COT Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring AI DeepSeek COT Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-30T12:32:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-30T12:32:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Spring AI DeepSeek COT Example\",\"datePublished\":\"2025-04-30T12:32:35+00:00\",\"dateModified\":\"2025-04-30T12:32:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html\"},\"wordCount\":1235,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"ollama\",\"spring ai\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html\",\"name\":\"Spring AI DeepSeek COT Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2025-04-30T12:32:35+00:00\",\"dateModified\":\"2025-04-30T12:32:38+00:00\",\"description\":\"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/spring-ai-deepseek-cot-example.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring AI DeepSeek COT Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring AI DeepSeek COT Example - Java Code Geeks","description":"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html","og_locale":"en_US","og_type":"article","og_title":"Spring AI DeepSeek COT Example - Java Code Geeks","og_description":"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.","og_url":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2025-04-30T12:32:35+00:00","article_modified_time":"2025-04-30T12:32:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Spring AI DeepSeek COT Example","datePublished":"2025-04-30T12:32:35+00:00","dateModified":"2025-04-30T12:32:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html"},"wordCount":1235,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["ollama","spring ai"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html","url":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html","name":"Spring AI DeepSeek COT Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2025-04-30T12:32:35+00:00","dateModified":"2025-04-30T12:32:38+00:00","description":"Spring ai deepseek cot: Learn how to build an AI chatbot using Spring AI and DeepSeek COT models with simple Java and Spring Boot steps.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/spring-ai-deepseek-cot-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring AI DeepSeek COT Example"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/133550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=133550"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/133550\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=133550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=133550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=133550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}