Elasticsearch:使用阿里云 AI 服务进行嵌入和重新排名

news2025/3/1 0:44:28

作者:来自 Elastic Tomás Murúa

将阿里云 AI 服务功能与 Elastic 结合使用。

更多阅读,请参阅 “Elasticsearch:使用阿里 infererence API 及 semantic text 进行向量搜索”。

在本文中,我们将介绍如何将阿里云 AI 功能与 Elasticsearch 集成,以提高语义搜索的相关性。

阿里云人工智能搜索是一种将高级人工智能功能与 Elasticsearch 工具相结合的解决方案,利用 Qwen LLM/DeepSeek-R1 系列提供高级推理和分类模型。在本文中,我们将使用同一作者撰写的小说和戏剧的描述来测试阿里巴巴重新排名和稀疏嵌入端点。

步骤

  1. 配置阿里云AI
  2. 创建 Elasticsearch 映射
  3. 将数据索引到 Elasticsearch 中
  4. 查询数据
  5. 奖励:完成回答问题

配置阿里云AI

阿里云 AI 重新排名和嵌入

开放推理阿里云(Open inference Alibaba Cloud)提供不同的服务。在此示例中,我们将使用阿加莎·克里斯蒂 (Agatha Christie) 的流行书籍和戏剧的描述来测试阿里云在语义搜索中的嵌入和重新排名端点。

阿里云 AI 重排名端点是一种语义重排名(semantic reranking)功能。这种重新排名使用机器学习模型根据搜索结果与查询的语义相似性对其进行重新排序。这使你可以在现有的全文搜索索引上使用开箱即用的语义搜索功能。

稀疏嵌入(sparse embedding)端点是一种大多数值为零的嵌入类型,使得相关信息更加突出。

获取阿里云 API Key

我们需要一个有效的 API 密钥来将阿里巴巴与 Elasticsearch 集成。要获取它,请按照下列步骤操作:

  • 从服务广场部分访问阿里云门户。
  • 转到左侧菜单 API Keys,如下所示。
  • 生成一个新的 API 密钥。

配置阿里巴巴端点

我们首先配置稀疏嵌入端点,将文本描述转换为语义向量:

嵌入端点

PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse
{
    "service": "alibabacloud-ai-search",
    "service_settings": {
        "api_key": "<api_key>",
        "service_id": "ops-text-sparse-embedding-001",
        "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
        "workspace": "default"
    }
}

然后我们将配置重新排序端点来重新组织结果。

重新排序端点

PUT _inference/rerank/alibabacloud_ai_search_rerank
{
    "service": "alibabacloud-ai-search",
    "service_settings": {
        "api_key": "<api_key>",
        "service_id": "ops-bge-reranker-larger",
        "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
        "workspace": "default"
    }
}

现在端点已经配置完毕,我们可以准备 Elasticsearch 索引。

创建 Elasticsearch 映射

让我们配置映射。为此,我们需要组织带有描述的文本以及模型生成的向量。

我们将使用以下属性:

  • semantic_description:存储模型生成的嵌入并运行语义搜索。
  • description:我们将使用 “text” 类型来存储小说(novels)和戏剧(plays)的描述,并使用它们进行全文搜索。

我们将包含 copy_to 参数,以便文本和语义字段均可用于混合搜索:

PUT arts
{
  "mappings": {
    "properties": {
      "semantic_description": {
        "type": "semantic_text",
        "inference_id": "alibabacloud_ai_search_sparse"
      },
      "description": {
        "type": "text",
        "copy_to": "semantic_description"
      }
    }
  }
}

映射准备好后,我们现在可以索引数据。

将数据索引到 Elasticsearch 中

这是我们将在本示例中使用的包含描述的数据集。我们将使用 Elasticsearch Bulk API 对其进行索引。

POST arts/_bulk
{ "index": {} }
{ "description": " Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive." }
{ "index": {} }
{ "description": "The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020." }
{ "index": {} }
{ "description": "The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance." }
{ "index": {} }
{ "description": " Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later." }
{ "index": {} }
{ "description": " Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head." }
{ "index": {} }
{ "description": " The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today." }

请注意,前两篇文献《Black Coffee - 黑咖啡》和《The Mousetraps - 捕鼠器》是戏剧(plays),而其他的是小说(novels)。

查询数据

为了查看不同类型查询的结果,我们将依次运行不同的查询类型,首先进行语义查询,然后应用重新排序,最后结合两者。我们将使用相同的问题:"Which novel was written by Agatha Christie?"(阿加莎·克里斯蒂写了哪部小说?),期望获得三个明确提到 “novel” 的文档,以及一个包含 “book” 的文档。同时,两部戏剧(plays)应排在最后。

语义搜索

我们将开始查询 semantic_text 字段来询问:“Which novel was written by Agatha Christie?” 让我们看看会发生什么:

GET /arts/_search
{
  "_source": {
    "includes": [
      "description"
    ]
  },
  "query": {
    "semantic": {
      "field": "semantic_description",
      "query": "Which novel was written by Agatha Christie?"
    }
  }
}

响应是:

{
  "took": 1246,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 6,
      "relation": "eq"
    },
    "max_score": 0.1759066,
    "hits": [
      {
        "_index": "arts",
        "_id": "rdJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.1759066,
        "_source": {
          "description": " Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head."
        }
      },
      {
        "_index": "arts",
        "_id": "rNJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.17499167,
        "_source": {
          "description": " Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later."
        }
      },
      {
        "_index": "arts",
        "_id": "q9J4-ZMB36zj9EVTnMgJ",
        "_score": 0.16319725,
        "_source": {
          "description": "The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance."
        }
      },
      {
        "_index": "arts",
        "_id": "qtJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.15506727,
        "_source": {
          "description": "The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020."
        }
      },
      {
        "_index": "arts",
        "_id": "qdJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.14572844,
        "_source": {
          "description": " Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive."
        }
      },
      {
        "_index": "arts",
        "_id": "rtJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.13951442,
        "_source": {
          "description": " The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today."
        }
      }
    ]
  }
}

在这种情况下,响应优先考虑了大多数小说,但写着 “book” 的文档出现在最后。我们仍然可以通过重新排序来进一步优化结果。

通过重新排序优化结果

在这种情况下,我们将使用 _inference/rerank 请求来评估我们在第一个查询中获得的文档并提高它们在结果中的排名。

POST _inference/rerank/alibabacloud_ai_search_rerank
{
  "query": "Which novel was written by Agatha Christie?",
  "input": [
    "Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive.",
    "The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020.",
    " The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance.",
    " Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later.",
    " Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head.",
    " The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today."
  ]
}

响应是:

{
  "rerank": [
    {
      "index": 3,
      "relevance_score": 0.91086304
    },
    {
      "index": 4,
      "relevance_score": 0.8409133
    },
    {
      "index": 2,
      "relevance_score": 0.76838577
    },
    {
      "index": 5,
      "relevance_score": 0.2295352
    },
    {
      "index": 0,
      "relevance_score": 0.13846178
    },
    {
      "index": 1,
      "relevance_score": 0.06620602
    }
  ]
}

这里的回应表明,这两部剧现在都处于结果的底部。

语义搜索和重新排名端点相结合

使用检索器,我们将语义查询和重新排序合并到一个步骤中:

POST /arts/_search
{
  "_source": {
    "includes": ["description"]
  },
  "retriever": {
    "text_similarity_reranker": {
      "retriever": {
        "standard": {
          "query": {
            "semantic": {
              "field": "semantic_description",
              "query": "Which novel was written by Agatha Christie?"
            }
          }
        }
      },
      "field": "description",
      "rank_window_size": 10,
      "inference_id": "alibabacloud_ai_search_rerank",
      "inference_text": "Which novel was written by Agatha Christie?"
    }
  }
}

响应是:

  "took": 1568,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 6,
      "relation": "eq"
    },
    "max_score": 0.91086304,
    "hits": [
      {
        "_index": "arts",
        "_id": "rNJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.91086304,
        "_source": {
          "description": " Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later."
        }
      },
      {
        "_index": "arts",
        "_id": "rdJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.8409133,
        "_source": {
          "description": " Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head."
        }
      },
      {
        "_index": "arts",
        "_id": "q9J4-ZMB36zj9EVTnMgJ",
        "_score": 0.76838577,
        "_source": {
          "description": "The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance."
        }
      },
      {
        "_index": "arts",
        "_id": "rtJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.2295352,
        "_source": {
          "description": " The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today."
        }
      },
      {
        "_index": "arts",
        "_id": "qdJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.13846178,
        "_source": {
          "description": " Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive."
        }
      },
      {
        "_index": "arts",
        "_id": "qtJ4-ZMB36zj9EVTnMgJ",
        "_score": 0.06620602,
        "_source": {
          "description": "The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020."
        }
      }
    ]
  }
}

这里的结果与语义查询有所不同。我们可以看到,尽管文档中没有与 "novel" 完全匹配的内容,但包含 "book"(如 The Murder of Roger Ackroyd)的文档在排名中比第一次语义搜索时更靠前。此外,两部戏剧仍然排在最后,就像重新排序时一样。

奖励:使用 completion 来完成回答问题

通过嵌入和重新排名,我们可以满足搜索查询,但用户仍然会看到所有搜索结果而不是实际答案。

通过提供的示例,我们距离 RAG 实现只有一步之遥,我们可以将最佳结果 + 问题提供给 LLM 以获得正确答案。

幸运的是,阿里云AI服务还提供了一个 completion 端点服务,我们可以利用它来实现这一目的。

让我们创建端点

使用阿里 QWen 创建 Completion 终点:

PUT _inference/completion/alibabacloud_ai_search_completion
{
    "service": "alibabacloud-ai-search",
    "service_settings": {
        "host" : "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
        "api_key": "<api_key>",
        "service_id": "ops-qwen-turbo",
        "workspace" : "default"
    }
}

我们也可以使用 deepseek-r1 来创建:

PUT _inference/completion/alibabacloud_ai_search_completion_deepseek_r1
{
    "service": "alibabacloud-ai-search",
    "service_settings": {
        "host" : "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
        "api_key": "{{API_KEY}}",
        "service_id": "deepseek-r1",
        "workspace" : "default"
    }
}

现在,发送上一个查询的结果和问题:

使用阿里 QWen 来进行查询

POST _inference/completion/alibabacloud_ai_search_completion
{
  "input": """
    Answer the following question using the context provided:
    QUESTION: Which novel was written by Agatha Christie?
    CONTEXT:
    DOCUMENT1
    Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive.
    DOCUMENT2
    The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020.
    DOCUMENT3
    The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance.
    DOCUMENT4
    Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later.
    DOCUMENT5
    Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head."
    DOCUMENT6
    The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today.
    ANSWER:
    """
}

响应是:

{
  "completion": [
{
      "result": "Agatha Christie wrote several novels, including \"The Body in the Murder,\" \"Curtain: Poirot's Last Case,\" \"Death on the Nile,\" and \"The Murder of Roger Ackroyd.\""
    }
  ]
}

使用阿里 deepseek-r1 来进行查询

POST _inference/completion/alibabacloud_ai_search_completion_deepseek_r1?timeout=180s
{
  "input": "<|system|>
    你是一个机器人助手.</s>
    <|user|>
    CONTEXT:

    Black Coffee is a play by the British crime-fiction author Agatha Christie. In the play, a scientist discovers that someone in his household has stolen the formula for an explosive;
  
    The Mousetrap is a murder mystery play by Agatha Christie. The play opened in London's West End in 1952 and ran continuously until 16 March 2020;
  
    The Body in the Murder is a Miss Marple mystery novel published by Agatha Christie in 1942. The case involves the murder of two teenage girls who are similar in appearance;

    Agatha Christie's last published novel before she passed, Curtain: Poirot's Last Case is also her indelible detective's last appearance. Poirot and Hastings return to the very same house from The Mysterious Affairs at Styles over 30 years later;
    
    Death on the Nile is Agatha Christie's most daring travel mystery novel. The tranquillity of a cruise along the Nile is shattered by the discovery that Linnet Ridgeway has been shot through the head;

    The Murder of Roger Ackroyd was Agatha Christie’s first book to be published by William Collins in the spring of 1926. William Collins became part of HarperCollins and are still Christie’s publishers today;
    
    QUESTION: 
    Which novela were written by Agatha Christie?</s>
    <|assistant|>"
}

:由于 DeepSeek 的推理时间比较长,所以,我们把 timeout 参数设置为 180s。

推理的结果如下:

{
  "completion": [
    {
      "result": """<think>
Okay, let's see. The user is asking which novels were written by Agatha Christie based on the given context. First, I need to go through each item in the context and determine if it's a novel. The user mentioned "novela," which I think is Spanish for "novel," so they're asking about novels, not plays or other works.

Looking at the context entries one by one:

1. **Black Coffee** is described as a play by Christie. So that's a play, not a novel. Exclude.

2. **The Mousetrap** is a murder mystery play, opened in London's West End. Definitely a play, not a novel. Exclude.

3. **The Body in the Murder** is listed as a Miss Marple mystery novel published in 1942. Wait, the title here might be a bit off. Agatha Christie wrote a novel called "The Body in the Library," which is a Miss Marple story from 1942. Maybe the user made a typo. Assuming it's "The Body in the Library," then yes, that's a novel. But the title given is "The Body in the Murder," which I don't recall. Need to check if that's a real title or a mistake. However, since the context says it's a Miss Marple novel published in 1942, I'll proceed with that, even if the title is slightly wrong. So include as a novel.

4. **Curtain: Poirot's Last Case** is mentioned as her last published novel before she passed. So that's a novel. Include.

5. **Death on the Nile** is described as a travel mystery novel. That's a novel. Include.

6. **The Murder of Roger Ackroyd** was her first book published by William Collins. That's a novel. Include.

So the novels listed here are: The Body in the Murder (assuming typo), Curtain, Death on the Nile, and The Murder of Roger Ackroyd. However, "The Body in the Murder" might actually be "The Body in the Library," which is the correct title. But since the user provided that exact title, I should list it as given, even if there's an error. Alternatively, note the possible typo.

Also, check if there are other works mentioned. The other entries are plays. So the answer should list the four novels mentioned in the context, being careful with the title accuracy.
</think>

The novels written by Agatha Christie mentioned in the context are:  

1. **The Body in the Murder** (likely a typo for *The Body in the Library*, a Miss Marple novel published in 1942).  
2. **Curtain: Poirot's Last Case** (her final published novel featuring Hercule Poirot).  
3. **Death on the Nile** (a travel mystery novel set on a Nile cruise).  
4. **The Murder of Roger Ackroyd** (her breakthrough novel published in 1926).  

*Note*:  
- *Black Coffee* and *The Mousetrap* are plays, not novels.  
- If "The Body in the Murder" is intended to refer to *The Body in the Library*, the latter is the correct title of Christie's 1942 Miss Marple novel."""
    }
  ]
}

结论

将阿里云 AI 搜索与 Elasticsearch 集成,使我们能够轻松访问完成、嵌入和重新排名模型,并将其合并到我们的搜索管道中。

我们可以借助检索器单独或一起使用重新排序和嵌入端点。

我们还可以引入 completion 端点来完成 RAG 端到端实现。

想要获得 Elastic 认证吗?了解下一期 Elasticsearch 工程师培训何时举行!

Elasticsearch 包含许多新功能,可帮助你为你的用例构建最佳的搜索解决方案。深入了解我们的示例笔记本以了解更多信息,开始免费云试用,或立即在本地机器上试用 Elastic。

原文:Embeddings and reranking with Alibaba Cloud AI Service - Elasticsearch Labs

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2307630.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

管理后台环境配置

后端配置及启动 a. 软件安装 1. Java sdk 1.8 2. maven 3.6 3. intellij IDEA 2024 4. Visual C Redistributable 5. mongodb 7.0 6. mysql 8.0 双击安装&#xff1a;mysql-installer-community-8.0.41.0.msi 版本选择&#xff1a;Full&#xff0c;包括服务器和客户端 …

数字IC低功耗后端设计实现之power gating和isolation技术

考虑低功耗设计需求&#xff0c;下图中间那个功能模块是需要做power domain的&#xff0c;即这个模块需要插MTCMOS。需要开启时&#xff0c;外面的VDD会和这个模块的LOCAL VDD形成通路&#xff0c;否则就是断开即power off状态。 这些低功耗设计实现经验&#xff0c;你真的懂了…

【网络编程】几个常用命令:ping / netstat / xargs / pidof / watch

ping&#xff1a;检测网络联通 1. ping 的基本功能2. ping 的工作原理3. ping 的常见用法4. ping 的输出解释5. ping 的应用场景6. 注意事项 netstat&#xff1a;查看网络状态 1. netstat 的基本功能2. 常见用法3. 示例4. 输出字段解释5. netstat 的替代工具6. 注意事项 xargs&…

sqlilab 46 关(布尔、时间盲注)

sqlilabs 46关&#xff08;布尔、时间盲注&#xff09; 46关有变化了&#xff0c;需要我们输入sort&#xff0c;那我们就从sort1开始 递增测试&#xff1a; 发现测试到sort4就出现报错&#xff1a; 我们查看源码&#xff1a; 从图中可看出&#xff1a;用户输入的sort值被用于查…

《Effective Objective-C》阅读笔记(下)

目录 内存管理 理解引用计数 引用计数工作原理 自动释放池 保留环 以ARC简化引用计数 使用ARC时必须遵循的方法命名规则 变量的内存管理语义 ARC如何清理实例变量 在dealloc方法中只释放引用并解除监听 编写“异常安全代码”时留意内存管理问题 以弱引用避免保留环 …

穷举vs暴搜vs深搜vs回溯vs剪枝(典型算法思想)—— OJ例题算法解析思路

回溯算法的模版 void backtrack(vector<int>& path, vector<int>& choice, ...) {// 满⾜结束条件if (/* 满⾜结束条件 */) {// 将路径添加到结果集中res.push_back(path);return;}// 遍历所有选择for (int i 0; i < choices.size(); i) {// 做出选择…

【Java项目】基于Spring Boot的校园博客系统

【Java项目】基于Spring Boot的校园博客系统 技术简介&#xff1a;采用Java技术、Spring Boot框架、MySQL数据库等实现。 系统简介&#xff1a;校园博客系统是一个典型的管理系统&#xff0c;主要功能包括管理员&#xff1a;首页、个人中心、博主管理、文章分类管理、文章信息…

计算机毕业设计SpringBoot+Vue.js图书进销存管理系统(源码+文档+PPT+讲解)

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 作者简介&#xff1a;Java领…

算法-数据结构(图)-迪杰斯特拉最短逻辑算法( Dijkstra)

迪杰斯特拉算法&#xff08;Dijkstras Algorithm&#xff09; 是一种用于计算单源最短路径的经典算法&#xff0c;由荷兰计算机科学家 艾兹赫尔迪杰斯特拉&#xff08;Edsger W. Dijkstra&#xff09; 于1956年提出。它的主要目标是找到从图中的某个源节点到所有其他节点的最短…

C语言【进阶篇】之指针——涵盖基础、数组与高级概念

目录 &#x1f680;前言&#x1f914;指针是什么&#x1f31f;指针基础&#x1f4af;内存与地址&#x1f4af;指针变量&#x1f4af; 指针类型&#x1f4af;const 修饰指针&#x1f4af;指针运算&#x1f4af;野指针和 assert 断言 &#x1f4bb;数组与指针&#x1f4af;数组名…

关于命令行下的 git( git add、git commit、git push)

文章目录 关于 gitgit 的概念git 操作&#xff08;git add、git commit、git push 三板斧&#xff09;安装 git新建仓库及配置git clone.gitignoregit addgit commitgit push其他 git 指令git pull&#xff08;把远端的东西拉到本地进行同步&#xff09;其他指令 关于 git git…

DaoCloud 亮相 2025 GDC丨开源赋能 AI 更多可能

2025 年 2 月 21 日至 23 日&#xff0c;上海徐汇西岸&#xff0c;2025 全球开发者先锋大会以 “模塑全球&#xff0c;无限可能” 的主题&#xff0c;围绕云计算、机器人、元宇宙等多元领域&#xff0c;探讨前沿技术创新、应用场景拓展和产业生态赋能&#xff0c;各类专业论坛、…

极速探索 HarmonyOS NEXT:开启国产操作系统开发的新篇章

极速探索 HarmonyOS NEXT&#xff1a;开启国产操作系统开发的新篇章 一、引言二、HarmonyOS NEXT 是什么&#xff1f;背景核心特性 三、HarmonyOS NEXT 的发展历程从 LiteOS 到 HarmonyOS 的逐步演进HarmonyOS NEXT 5.0 的发布 四、HarmonyOS NEXT 对科技的影响技术突破开发者生…

火狐浏览器多开指南:独立窗口独立IP教程

无论是跨境电商从业者需要管理多个店铺账号&#xff0c;还是海外社交媒体营销人员要运营多个社交平台账号&#xff0c;亦或是从事多账号广告投放的人员&#xff0c;都面临着一个共同的挑战 —— 如何高效管理多个账号&#xff0c;并确保每个账号的独立性。 在这种情况下&#…

内容中台是什么?内容管理平台解析

内容中台的核心价值 现代企业数字化转型进程中&#xff0c;内容中台作为中枢系统&#xff0c;通过构建统一化的内容管理平台实现数据资产的高效整合与智能调度。其核心价值体现在打破传统信息孤岛&#xff0c;将分散于CRM、ERP等系统的文档、知识库、产品资料进行标准化归集&a…

1.2 Kaggle大白话:Eedi竞赛Transformer框架解决方案02-GPT_4o生成训练集缺失数据

目录 0. 本栏目竞赛汇总表1. 本文主旨2. AI工程架构3. 数据预处理模块3.1 配置数据路径和处理参数3.2 配置API参数3.3 配置输出路径 4. AI并行处理模块4.1 定义LLM客户端类4.2 定义数据处理函数4.3 定义JSON保存函数4.4 定义数据分片函数4.5 定义分片处理函数4.5 定义文件名排序…

sql server笔记

创建数据库 use master gocreate database stuuuuu//删除数据库if db_id ($$$) is not nullDrop database [$$$] go//新建表USE [studyTest] GOSET ANSI_NULLS ON GOSET QUOTED_IDENTIFIER ON GOCREATE TABLE [dbo].[Table_1]([id] [int] NULL,[name] [varchar](10) NULL ) ON…

uni小程序wx.switchTab有时候跳转错误tab问题,解决办法

在一个子页面里面使用uni.switchTab或者wx.switchTab跳转到tab菜单的时候&#xff0c;先发送了一个请求&#xff0c;然后执行跳转到tab菜单&#xff0c;但是这个时候&#xff0c;出错了........也是非常的奇怪&#xff0c;不加请求就没问题......但是业务逻辑就是要先执行某个请…

【第十节】C++设计模式(结构型模式)-Flyweight( 享元)模式

目录 一、问题背景 二、模式选择 三、代码实现 四、总结讨论 一、问题背景 享元模式&#xff08;Flyweight Pattern&#xff09;在对象存储优化中的应用 在面向对象系统的设计与实现中&#xff0c;创建对象是最常见的操作之一。然而&#xff0c;如果一个应用程序使用了过多…

AORO M6北斗短报文终端:将“太空黑科技”转化为安全保障

在卫星导航领域&#xff0c;北斗系统作为我国自主研发的全球卫星导航系统&#xff0c;正以其独特的短报文通信功能引发全球范围内的广泛关注。这一突破性技术不仅使北斗系统在全球四大导航系统中独树一帜&#xff0c;具备了双向通信能力&#xff0c;更通过遨游通讯推出的AORO M…