Elasticsearch 查询规则现已正式发布 - query rules

news2024/11/15 16:50:41

作者:来自 Elastic Kathleen DeRusso

查询规则(query rules)允许使用细粒度、上下文特定的解决方案来更改特定查询或搜索用例的搜索结果。这对于需要将品牌或赞助结果固定在特定关键字的搜索结果列表顶部的广告系列很有帮助,但对于只需要 “修复” 顶部结果的热门查询也很有帮助。

简介

我们很高兴地宣布,查询规则已在我们的 serverless 产品中正式发布,并且将从堆栈版本 8.15.0 开始普遍可用。查询规则最初在 8.10.0 中作为技术预览功能引入,并允许索引维护者根据上下文查询输入的条件整理特定文档以将其固定在结果顶部。

查询规则如何工作?

查询规则是你根据特定查询元数据定义的规则。首先,你需要定义一个查询规则集,该规则集会识别要针对查询中发送的某些元数据进行推广的文档。然后在搜索时,你将该元数据与规则查询一起发送。如果规则查询中发送的元数据与任何规则匹配,则这些规则将应用于你的结果集。

新的查询规则功能

我们在向正式版迈进的过程中为查询规则添加了一些功能。

这些变化的简要概述:

  • 我们将规则查询从 rule_query 重命名为rule,以与我们的其他API调用更加一致
  • 我们现在支持在单个规则查询中指定多个规则集
  • 我们扩展了 query ruleset management APIs 以支持管理单个查询规则

这是什么样子的?

假设我们有一个包含狗品种信息的索引,其中包含两个字段:dog_breed 和 advert。我们想要设置规则,将品种和混合品种固定在同一个规则中。这是一个包含两个规则的示例规则集:

PUT _query_rules/dog-breed-ruleset
{
 "ruleset_id": "dog-breed-ruleset",
 "rules": [
   {
     "rule_id": "pug-mixes",
     "type": "pinned",
     "criteria": [
       {
         "type": "exact",
         "metadata": "breed",
         "values": [
           "pug"
         ]
       }
     ],
     "actions": {
       "ids": [
         "pug",
         "puggle",
         "chug",
         "pugshire"
       ]
     },
     "priority": 5
   },
   {
     "rule_id": "chi-mixes",
     "type": "pinned",
     "criteria": [
       {
         "type": "exact",
         "metadata": "breed",
         "values": [
           "chihauhua"
         ]
       }
     ],
     "actions": {
       "ids": [
         "chihauhua",
         "chiweenie",
         "chug"
       ]
     },
     "priority": 10
   }
 ]
}

解析此规则集的作用:

  1. 如果规则查询发送品种:pug,则按顺序显示的第一个结果将是:pug、puggle、chug 和 pugshire。任何自然结果都将在这些固定结果之后返回。
  2. 如果规则查询发送品种:chihuahua,则按顺序显示的第一个结果将是:chihuahua、chiweenie 和 chug。任何自然结果都将在这些固定结果之后返回。

需要注意的一点是规则集中每个规则的优先级。这是每个规则的可选部分,但它可以帮助你定义单个规则插入规则集的位置。规则集按优先级升序排序,但正如你在此示例中所见,它们不必连续。将优先级为 4 或更低的新规则插入此规则集会将新规则插入规则集的开头,而优先级介于 6 和 9 之间会将新规则插入规则集中间两个现有规则之间。如果将单个规则添加到规则集中但不包含优先级,则它将被简单地附加到规则集的末尾。

查询规则的另一个有用功能是我们现在支持将多个规则集传递到规则查询中。这允许你组织和定义更多规则;以前,你只能在单个规则集中容纳有限的规则数量(默认情况下为 100 条,或可配置为每个规则集最多 1000 条)。

让我们通过专门为 7 月促销活动创建一个新规则集来看看它是什么样子。此规则的类型为 “always”,因此无论如何它都会始终返回:

PUT _query_rules/promo-ruleset
{
  "rules": [
    {
      "rule_id": "july-promo",
      "type": "pinned",
      "criteria": [
        {
          "type": "always"
        }
      ],
      "actions": {
        "ids": [
          "july-promotion"
        ]
      }
    }
  ]
}

现在,我们可以使用以下查询一起查询这些规则集:

GET query-rules-test/_search
{
  "query": {
    "rule": {
      "organic": {
        "query_string": {
          "query": "chihauhua mixes"
        }
      },
      "ruleset_ids": [
        "promo-ruleset",
        "dog-breed-ruleset"
      ],
      "match_criteria": {
        "breed": "chihauhua"
      }
    }
  }
}

由于指定了两个规则集,我们将按照请求中指定的顺序处理每个规则集。这意味着七月促销规则将始终作为第一个结果返回,匹配的狗品种将随后被置顶,结果如下所示:

   "hits": [
     {
       "_index": "query-rules-test",
       "_id": "july-promotion",
       "_score": 1.7014128e+38,
       "_source": {
         "advert": "EVERYTHING ON SALE!"
       }
     },
     {
       "_index": "query-rules-test",
       "_id": "chihauhua",
       "_score": 1.7014126e+38,
       "_source": {
         "dog_breed": "chihauhua"
       }
     },
     {
       "_index": "query-rules-test",
       "_id": "chiweenie",
       "_score": 1.7014124e+38,
       "_source": {
         "dog_breed": "chiweenie"
       }
     },
     {
       "_index": "query-rules-test",
       "_id": "chug",
       "_score": 1.7014122e+38,
       "_source": {
         "dog_breed": "chug"
       }
     },
     ... // organic results follow... 
   ]

这些都是简单的例子,那么一些更复杂的例子呢?

我们可以提供帮助!
​​
让我们继续我们的狗主题,但扩展测试索引中的映射:

PUT query-rules-test
{
 "mappings": {
   "properties": {
     "breed": {
       "type": "keyword"
     },
     "age": {
       "type": "integer"
     },
     "sex": {
       "type": "keyword"
     },
     "name": {
       "type": "keyword"
     },
     "bio": {
       "type": "text"
     },
     "good_with_animals": {
       "type": "boolean"
     },
     "good_with_kids": {
        "type": "boolean"
     }
   }
 }
}

我们可以将以下 json 索引到此索引中以获取一些示例数据。为了保持一致性,我们假设 _id 字段与 json id 字段匹配:

[
  {"id":"buddy_pug","breed":"pug","sex":"Male","age":3,"name":"Buddy","bio":"Buddy is a charming pug who loves to play and snuggle. He is looking for a loving home.","good_with_animals":true,"good_with_kids":true},
  {"id":"lucy_beagle","breed":"beagle","sex":"Female","age":7,"name":"Lucy","bio":"Lucy is a friendly beagle who enjoys long walks and is very affectionate.","good_with_animals":true,"good_with_kids":true},
  {"id":"rocky_chihuahua","breed":"chihuahua","sex":"Male","age":2,"name":"Rocky","bio":"Rocky is a tiny chihuahua with a big personality. He is very playful and loves attention.","good_with_animals":false,"good_with_kids":false},
  {"id":"zoe_dachshund","breed":"dachshund","sex":"Female","age":5,"name":"Zoe","bio":"Zoe is a sweet dachshund who loves to burrow under blankets and is very loyal.","good_with_animals":true,"good_with_kids":true},
  {"id":"max_poodle","breed":"poodle","sex":"Male","age":6,"name":"Max","bio":"Max is a smart and active poodle who loves learning new tricks and is very friendly.","good_with_animals":true,"good_with_kids":true},
  {"id":"bella_yorkie","breed":"yorkie","sex":"Female","age":4,"name":"Bella","bio":"Bella is a cute yorkie who loves to be pampered and is very affectionate.","good_with_animals":true,"good_with_kids":true},
  {"id":"jack_puggle","breed":"puggle","sex":"Male","age":8,"name":"Jack","bio":"Jack is a friendly puggle who loves to play and is very social.","good_with_animals":true,"good_with_kids":true},
  {"id":"lola_chiweenie","breed":"chiweenie","sex":"Female","age":9,"name":"Lola","bio":"Lola is a playful chiweenie who loves to chase toys and is very affectionate.","good_with_animals":true,"good_with_kids":true},
  {"id":"charlie_chug","breed":"chug","sex":"Male","age":3,"name":"Charlie","bio":"Charlie is an energetic chug who loves to play and is very curious.","good_with_animals":false,"good_with_kids":true},
  {"id":"daisy_pugshire","breed":"pugshire","sex":"Female","age":7,"name":"Daisy","bio":"Daisy is a gentle pugshire who loves to cuddle and is very sweet.","good_with_animals":true,"good_with_kids":true},
  {"id":"buster_pug","breed":"pug","sex":"Male","age":10,"name":"Buster","bio":"Buster is a calm pug who loves to lounge around and is very loyal.","good_with_animals":true,"good_with_kids":true},
  {"id":"molly_beagle","breed":"beagle","sex":"Female","age":12,"name":"Molly","bio":"Molly is a sweet beagle who loves to sniff around and is very friendly.","good_with_animals":true,"good_with_kids":true},
  {"id":"toby_chihuahua","breed":"chihuahua","sex":"Male","age":4,"name":"Toby","bio":"Toby is a lively chihuahua who loves to run around and is very playful.","good_with_animals":false,"good_with_kids":false},
  {"id":"luna_dachshund","breed":"dachshund","sex":"Female","age":1,"name":"Luna","bio":"Luna is a young dachshund who loves to explore and is very curious.","good_with_animals":true,"good_with_kids":true},
  {"id":"oliver_poodle","breed":"poodle","sex":"Male","age":17,"name":"Oliver","bio":"Oliver is a wise poodle who loves to relax and is very gentle.","good_with_animals":true,"good_with_kids":true}]

我们使用如下的方法进行写入:

PUT _bulk
{"index":{"_index":"query-rules-test","_id":"buddy_pug"}}
{"id":"buddy_pug","breed":"pug","sex":"Male","age":3,"name":"Buddy","bio":"Buddy is a charming pug who loves to play and snuggle. He is looking for a loving home.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"lucy_beagle"}}
{"id":"lucy_beagle","breed":"beagle","sex":"Female","age":7,"name":"Lucy","bio":"Lucy is a friendly beagle who enjoys long walks and is very affectionate.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"rocky_chihuahua"}}
{"id":"rocky_chihuahua","breed":"chihuahua","sex":"Male","age":2,"name":"Rocky","bio":"Rocky is a tiny chihuahua with a big personality. He is very playful and loves attention.","good_with_animals":false,"good_with_kids":false}
{"index":{"_index":"query-rules-test","_id":"zoe_dachshund"}}
{"id":"zoe_dachshund","breed":"dachshund","sex":"Female","age":5,"name":"Zoe","bio":"Zoe is a sweet dachshund who loves to burrow under blankets and is very loyal.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"max_poodle"}}
{"id":"max_poodle","breed":"poodle","sex":"Male","age":6,"name":"Max","bio":"Max is a smart and active poodle who loves learning new tricks and is very friendly.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"bella_yorkie"}}
{"id":"bella_yorkie","breed":"yorkie","sex":"Female","age":4,"name":"Bella","bio":"Bella is a cute yorkie who loves to be pampered and is very affectionate.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"jack_puggle"}}
{"id":"jack_puggle","breed":"puggle","sex":"Male","age":8,"name":"Jack","bio":"Jack is a friendly puggle who loves to play and is very social.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"lola_chiweenie"}}
{"id":"lola_chiweenie","breed":"chiweenie","sex":"Female","age":9,"name":"Lola","bio":"Lola is a playful chiweenie who loves to chase toys and is very affectionate.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"charlie_chug"}}
{"id":"charlie_chug","breed":"chug","sex":"Male","age":3,"name":"Charlie","bio":"Charlie is an energetic chug who loves to play and is very curious.","good_with_animals":false,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"daisy_pugshire"}}
{"id":"daisy_pugshire","breed":"pugshire","sex":"Female","age":7,"name":"Daisy","bio":"Daisy is a gentle pugshire who loves to cuddle and is very sweet.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"buster_pug"}}
{"id":"buster_pug","breed":"pug","sex":"Male","age":10,"name":"Buster","bio":"Buster is a calm pug who loves to lounge around and is very loyal.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"molly_beagle"}}
{"id":"molly_beagle","breed":"beagle","sex":"Female","age":12,"name":"Molly","bio":"Molly is a sweet beagle who loves to sniff around and is very friendly.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"toby_chihuahua"}}
{"id":"toby_chihuahua","breed":"chihuahua","sex":"Male","age":4,"name":"Toby","bio":"Toby is a lively chihuahua who loves to run around and is very playful.","good_with_animals":false,"good_with_kids":false}
{"index":{"_index":"query-rules-test","_id":"luna_dachshund"}}
{"id":"luna_dachshund","breed":"dachshund","sex":"Female","age":1,"name":"Luna","bio":"Luna is a young dachshund who loves to explore and is very curious.","good_with_animals":true,"good_with_kids":true}
{"index":{"_index":"query-rules-test","_id":"oliver_poodle"}}
{"id":"oliver_poodle","breed":"poodle","sex":"Male","age":17,"name":"Oliver","bio":"Oliver is a wise poodle who loves to relax and is very gentle.","good_with_animals":true,"good_with_kids":true}

接下来,让我们创建一个规则集:

PUT _query_rules/rescue-dog-search-ruleset
{
  "rules": [
    {
      "rule_id": "pugs_and_pug_mixes",
      "type": "pinned",
      "criteria": [
        {
          "type": "contains",
          "metadata": "query_string",
          "values": [
            "pug"
          ]
        }
      ],
      "actions": {
        "ids": [
          "buddy_pug",
          "buster_pug",
          "jack_puggle",
          "daisy_pugshire"
        ]
      }
    },
    {
      "rule_id": "puppies",
      "type": "pinned",
      "criteria": [
        {
          "type": "contains",
          "metadata": "query_string",
          "values": [
            "puppy",
            "puppies"
          ]
        }
      ],
      "actions": {
        "ids": [
          "luna_dachsund"
        ]
      }
    },
    {
      "rule_id": "puppies2",
      "type": "pinned",
      "criteria": [
        {
          "type": "lte",
          "metadata": "preferred_age",
          "values": [
            2
          ]
        }
      ],
      "actions": {
        "ids": [
          "luna_dachshund"
        ]
      }
    },
    {
      "rule_id": "adult",
      "type": "pinned",
      "criteria": [
        {
          "type": "gt",
          "metadata": "preferred_age",
          "values": [
            2
          ]
        },
        {
          "type": "lt",
          "metadata": "preferred_age",
          "values": [
            10
          ]
        }
      ],
      "actions": {
        "ids": [
          "lucy_beagle"
        ]
      }
    },
    {
      "rule_id": "special_needs",
      "type": "pinned",
      "criteria": [
        {
          "type": "exact",
          "metadata": "work_from_home",
          "values": [
            "true"
          ]
        },
        {
          "type": "exact",
          "metadata": "fenced_in_yard",
          "values": [
            "true"
          ]
        },
        {
          "type": "exact",
          "metadata": "kids_in_house",
          "values": [
            "false"
          ]
        },
        {
          "type": "exact",
          "metadata": "cats_in_house",
          "values": [
            "false"
          ]
        }
      ],
      "actions": {
        "ids": [
          "toby_chihuahua"
        ]
      }
    }
  ]
}

解析此规则集:

  • 有一个 pugs_and_pug_mixes 规则,如果查询字符串包含单词 “pug”,它将固定所有哈巴狗(pugs)和哈巴狗混种(pug mixes)
  • 如果查询字符串包含 “puppy” 或 “puppies”,则 puppies 规则将返回索引中最年轻的狗 luna_dachshund
  • 如果首选年龄小于或等于 2 岁,另一个 puppies2 规则将返回同一只狗(也即 luna_dachshund )
  • 如果首选年龄在 2 到 10 岁之间,adult 规则将固定特定的比格犬  lucy_beagle
  • 我们有一个复杂的 special_needs 规则,只有当准主人在家工作(work_from_home 为 true)、院子有围栏(fenced_in_yard 为 true)并且家里没有孩子(kids_in_house 为 false )并且猫在家里(cats_in_house 为 false),该规则才会生效。

让我们看一些示例查询 - 这些示例使用 match_none 作为有机查询,因此返回的结果仅针对规则本身。

GET query-rules-test/_search
{
  "query": {
    "rule": {
      "organic": {
        "match_none": {}
      },
      "ruleset_ids": [
        "rescue-dog-search-ruleset"
      ],
      "match_criteria": {
        "query_string": "I like pugs and pug mixes",
        "preferred_age": 5
      }
    }
  }
}

上述查询将匹配 “pug and pug mixes”规则并返回 4 条哈巴狗结果。但是,由于首选年龄为 5 岁,我们将返回成年狗 Lucy 小猎犬作为第 5 个置顶结果。

将首选年龄更改为 1 会将哈巴狗结果下方的第 5 个结果替换为 dachshund 幼犬:

GET query-rules-test/_search
{
  "query": {
    "rule": {
      "organic": {
        "match_none": {}
      },
      "ruleset_ids": [
        "rescue-dog-search-ruleset"
      ],
      "match_criteria": {
        "query_string": "I like pugs and pug mixes",
        "preferred_age": 1
      }
    }
  }
}

为了符合特殊需求的结果,所有标准必须符合:

{
  "query": {
    "rule": {
      "organic": {
        "match_none": {}
      },
      "ruleset_ids": [
        "rescue-dog-search-ruleset"
      ],
      "match_criteria": {
        "work_from_home": "true",
        "fenced_in_yard": "true",
        "kids_in_house": "false",
        "cats_in_house": "false"
      }
    }
  }
}

如果单个条件不匹配,则不会触发此规则:

GET query-rules-test/_search
{
  "query": {
    "rule": {
      "organic": {
        "match_none": {}
      },
      "ruleset_ids": [
        "rescue-dog-search-ruleset"
      ],
      "match_criteria": {
        "work_from_home": "true",
        "fenced_in_yard": "true",
        "kids_in_house": "false",
        "cats_in_house": "true"
      }
    }
  }
}

查询规则故障排除

可能很难判断是否应用了固定查询规则。有两种方法可以判断查询规则是固定了你想要的文档还是自然返回。

我们确实有 explain API,但这可能不明显:规则查询被重写为固定查询,然后被重写为恒定分数查询,因此这基本上看起来像最大可能分数:

"_explanation": {
  "value": 1.7014128e+38,
  "description": "max of:",
  "details": [
    {
      "value": 1.7014128e+38,
      "description": "max of:",
      "details": [
        {
          "value": 1.7014128e+38,
          "description": "ConstantScore(_id:([ff 63 68 69 68 61 75 68 75 61]))^1.7014128E38",
          "details": []
        },
        ...
      ]
    },
    ...
  ]
}

对于 pinned rules,你还可以使用规则查询与不匹配查询相结合的方式仅返回规则,正如我们上面为了说明目的所做的那样:

GET query-rules-test/_search
{
  "query": {
    "rule": {
      "organic": {
        "match_none": {}
      },
      "ruleset_ids": [
        "dog-breed-ruleset",
        "super-special-ruleset"
      ],
      "match_criteria": {
        "breed": "pug"
      }
    }
  }
}

或者,你可以简单地运行 organic 查询,并将该查询的结果与规则查询进行比较。

下一步是什么?

查询规则已普遍可用,但这并不意味着我们已经完成了!

我们的路线图上有很多令人兴奋的功能,包括:

  • 添加对排除文档和固定文档的支持
  • 无需进行 API 调用即可轻松管理查询规则的 UI
  • 分析器支持
  • ... 还有更多!

我们还在研究人们可能感兴趣的其他使用查询规则的方式。我们很乐意在我们的社区页面上听到你的反馈!

准备好自己尝试一下了吗?开始免费试用。
想要获得 Elastic 认证吗?了解下一次 Elasticsearch 工程师培训何时举行!

原文:Elasticsearch query rules are now generally available — Search Labs

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

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

相关文章

B2 双电机系列挂轨巡检机器人:解决巡检难题,提升工业效能

随着工业自动化的不断发展,传统的人工巡检方式已经难以满足现代工业对安全、效率和精度的要求。旗晟机器人推出的B2双电机系列挂轨巡检机器人,以其独特的优势,为工业巡检领域带来了革命性的变化。 一、产品亮点 B2双电机系列挂轨巡检机器人以…

数据结构初阶最终讲:排序

数据结构初阶最终讲:排序 1.排序的概念及其运用1.1什么是排序1.2排序的运用1.3常见排序算法 2.冒泡排序3.直接插入排序4.堆排序5.测试代码:排序性能对比5.1直接插入排序时间复杂度分析 6.希尔排序6.1希尔排序时间复杂度分析 7.选择排序7.1初步思路7.2选择…

【Python系列】异步编程在 Python 中的应用

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

WinCC7.5零基础教学:多功能VB/C脚本基础框架模板程序详解!报表、配方、面板类型、菜单栏切换画、IO控制模板一应俱全,0基础小白值得拥有!

了解基础框架完整功能请观看视频! 观看完整教学视频点击这里(腾讯视频可放心观看) 以下是wincc多功能脚本基础框架项目功能简介: 功能一:多功能标题窗口模块 模块主要功能包括实时报警窗口信息、人员登录登出、报警消…

24暑假算法刷题 | Day30 | 贪心算法 IV | 452. 用最少数量的箭引爆气球,435. 无重叠区间,763. 划分字母区间

目录 452. 用最少数量的箭引爆气球题目描述题解 435. 无重叠区间题目描述题解 763. 划分字母区间题目描述题解 452. 用最少数量的箭引爆气球 点此跳转题目链接 题目描述 有一些球形气球贴在一堵用 XY 平面表示的墙面上。墙面上的气球记录在整数数组 points ,其中…

印刷企业实施数字工厂管理系统后能提升哪些效益

在当今这个数字化转型浪潮席卷全球的时代,印刷企业作为传统制造业的重要组成部分,正面临着前所未有的挑战与机遇。为了提升生产效率、降低成本、增强市场竞争力,越来越多的印刷企业开始引入数字工厂管理系统,这一举措不仅重塑了企…

Inno Setup根据系统的不同(32位/64位)安装不同的exe

注意事项 Inno Setup6.0及以上版本生成的可执行文件,可以运行在Windows7及以上系统,不支持WindowsXP系统。 如果要运行在WindowsXP系统上,需要下载Inno Setup6.0之前的版本。 Inno Setup 汉化版5.3.4下载链接: https://download…

从入门到精通:大学生编程技能提升全攻略

文章目录 每日一句正能量前言编程语言选择编程语言选择:为新手导航Python:初学者的友好伙伴JavaScript:Web开发的核心Java:企业级应用的经典C:系统编程的基石Ruby:优雅高效的编程Swift:iOS开发的…

OBS设置大揭秘:参数优化技巧与顶级录屏软件全攻略

在这个数字化的时代,屏幕录制已成为我们记录和分享知识、技能的重要手段。如果你还在为寻找一款既专业又易用的录屏软件而烦恼,那么今天的文章将为你揭开谜底。 录屏软件一、OBS studio OBS studio,作为录屏和直播领域的标杆,其功…

echarts图例旁边加百分比及百分比对齐

一、效果图 在这里插入图片描述 二、代码 import cirle from /assets/imgs/dataScree/ybp.pnglet option{tooltip: {trigger: item,formatter: function (params) {return }},legend: {orient: vertical, // 图例列表的布局朝向,horizontal为水平,vertical为垂直…

电话机器人能提升销售效率

经济敏捷发展的当天,任何行业都不离开市场,无法让更多人理解本人企业本人的产物。那样的话,像电话营销那样抢手的行业也面临很大的困难,员工不仅工作压力大,工作时间长,呼叫量多,还能忍受顾客的…

LangChain: Reduce size of tokens being passed to OpenAI

题意:在使用 LangChain时,需要减少传递给OpenAI的令牌(tokens)的数量 问题背景: I am using LangChain to create embeddings and then ask a question to those embeddings like so: 我正在使用 LangChain 来创建嵌…

记录|To run this application, you must install .NET Core.【C#,VS】

目录 前言一、问题描述二、解决办法三、.NET版本和Windows版本对接更新时间 前言 参考文章: 1、安装失败,提示“To run this application,you must install .netcore…” 2、【bug】to run this application ,you must install .net 3、在 Windows 上安装…

【亲测管用】Windows11 部署Maxkb + 本地Ollama

一、下载地址 maxkb:https://maxkb.cn/ ollama: https://ollama.com/download/windows 二、安装ollama 2.1 默认安装 直接install就好,默认是安装到C盘里面的。 安装好之后会显示在 直接打开cmd黑窗口,输入命令即可查看。 2.2 ollama…

什么牌子的洗地机好用?石头、添可、希亦真实使用测评对比!

随着科技的不断进步,许多人已经更新了家中的清洁工具。在挑选时,大家可能会看到很多网络攻略,但看得越多,反而越难抉择。其实,最直接的方法是看看这些工具的真实使用体验,这样就能大概知道自己使用时的感受…

5G 网络切片

5G 业务分类 增强型移动宽带(eMBB) 传统数据业务,特点是高带宽超高可靠性低时延业务(URLLC)无人驾驶、工业自动化等业务, 特点是高可靠、低时延海量机器类通信(mMTC) 物联网,特点是大量连接,时延不敏感,数…

练习2.19

先上代码吧。 (defn first-denomination [coin-values](first coin-values))(defn no-more? [coin-values](if (empty? coin-values) truefalse))(defn except-first-denomination [coin-values ](rest coin-values ))(defn cc[amount coin-values](cond ( amount 0) 1(or (…

ChatGPTAI指令提示工程案例

一、AI指令提示工程概述 AI指令提示工程(AI Prompt Engineering)是指通过设计巧妙的提示词(Prompt)来引导人工智能模型,特别是像ChatGPT这样的自然语言处理模型,生成符合用户需求的回答。这一过程不仅涉及…

重塑视界,流畅无界:『Levels of Detail』

在那片烽火连天的虚拟疆域——《刺激战场》中,你是否曾披荆斩棘,穿梭于一个个错落有致的城市迷宫?当我们飞越天际,俯瞰那些精心雕琢的城市场景,心中是否闪过一丝好奇的火花:在这广阔天地间,为何…

冷门细分才是王道,小白用AI几分钟生成,都有出了7000+单了

现在大家都在说,网上整点米,越来越难了,竞争太激烈。那要不看看冷门赛道,看这样冷门细分赛道,【绘本故事】,我视频号,和其他平台都搜了下,千赞,万赞很多。 这样的图片大家…