在Qt中引入Generative AI

Introducing Generative AI in Qt

在Qt中引入Generative AI

June 06, 2023 by Peter Schneider | Comments

​2023年6月6日:Peter Schneider |评论

Will Generative Artificial Intelligence change how we develop Qt applications? We asked ourselves this question, and instead of thinking about it too long, we decided to make it happen. We implemented a Github Copilot integration in Qt Creator 11 as a Technical Preview.

Generative人工智能会改变我们开发Qt应用程序的方式吗?我们问了自己这个问题,我们没有想太久,而是决定让它发生。我们在Qt Creator 11中实现了Github Copilot集成作为技术预览。

How does Generative AI work in Qt Creator?

Generative AI如何在Qt Creator中工作?

We have seen it so often that developers get tired of programming repetitive code, creating endless test cases, and searching online for code suggestions.

我们经常看到这种情况,以至于开发人员厌倦了编写重复的代码、创建无休止的测试用例和在线搜索代码建议。

The GitHub Copilot integration makes developers more effective when writing code, allowing them to focus on the business logic instead of reinventing the wheel.

GitHub Copilot集成使开发人员在编写代码时更加有效,使他们能够专注于业务逻辑,而不是重新发明轮子。

GitHub Copilot suggests lines of code, complete functions, and test cases in the editor of the Qt Creator. GitHub Copilot offers new code “based on the project's context and style conventions.” Developers can apply suggestions as a whole or only parts of them.

GitHub Copilot在Qt Creator的编辑器中建议代码行、完整的函数和测试用例。GitHub Copilot提供了“基于项目上下文和风格约定”的新代码。开发人员可以将建议作为一个整体或仅部分应用。

在Qt中引入Generative AI_第1张图片

Screen capture of Test Case Suggestion by GitHub Copilot in Qt Creator editor window

GitHub Copilot在Qt Creator编辑器窗口中的测试用例建议截屏

GitHub Copilot is a commercial AI code assistant tool. You can try it out for 30 days free of charge, after which it is at least $10 per month for individuals or $19 per month for an Enterprise license at the time of writing this post.

GitHub Copilot是一款商业人工智能代码助理工具。您可以免费试用30天,之后在撰写本文时,个人每月至少10美元,企业许可证每月至少19美元。

Increasing productivity with Augmented Intelligence

使用增强智能提高生产力

The GitHub Copilot integration is the first AI functionality readily integrated by the Qt Company in Qt’s developer tools. Whatever we will do in the future in Artificial Intelligence will follow our mission of optimizing productivity in the entire product development process. We want to supercharge innovations. We want to turn ideas into software. More importantly, we want you to see us as a partner for your creativity. AI might mean for us Augmented Intelligence rather than purely Artificial Intelligence.

GitHub Copilot集成是Qt公司在Qt开发工具中轻松集成的第一个人工智能功能。无论我们未来在人工智能方面做什么,都将遵循我们在整个产品开发过程中优化生产力的使命。我们希望加大创新力度。我们想把创意转化为软件。更重要的是,我们希望您将我们视为您创造力的合作伙伴。人工智能对我们来说可能意味着增强智能,而不是纯粹的人工智能。

Qt will focus on Augmented Intelligence, which supports you as a virtual buddy rather than trying to replace you.

​Qt将专注于增强智能,它支持你成为虚拟好友,而不是试图取代你。

The GitHub Copilot is an excellent example of this intent. Github Copilot makes suggestions that you can take over, modify, or simply ignore (in that way, it's even better than a human colleague because you don’t need to be polite in your rejections). 

GitHub Copilot就是一个很好的例子。Github Copilot提出了一些建议,你可以接管、修改或简单地忽略这些建议(这样,它甚至比人类同事更好,因为你在拒绝时不需要礼貌)。

Considerations on using Generative AI

关于使用Generative AI的思考


The integration of GitHub Copilot is a technological and a commercial challenge. Obviously, GitHub Copilot is a third-party service, admittedly a great one, but that means it comes with an additional set of terms and conditions which are not under the control of The Qt Company. The terms and conditions for Generative AI are tricky. Firstly, the laws and ethics around augmented code generation are still evolving. There are no commonly accepted rules. Secondly, whether the terms and conditions for Generative AI providers are acceptable depends on how you judge the rights of the sources used in training the algorithms.

GitHub Copilot的集成是一项技术和商业挑战。显然,GitHub Copilot是一项第三方服务,诚然是一项伟大的服务,但这意味着它附带了一套不受Qt公司控制的额外条款和条件。Generative AI的条款和条件很棘手。首先,围绕增强代码生成的法律和伦理仍在发展。没有公认的规则。其次,Generative AI提供商的条款和条件是否可接受,取决于你如何判断训练算法时使用的来源的权利。

Is Generative AI only an automated way to launder non-permissive open source code? What level of minor justifications makes a “copy” of non-permissive, non-copyleft code, such as under General Public License (GPL) terms, acceptable as new IPR? Is the change of a variable name or a different declaration of a variable enough? It won't be considered enough change if a human manually modifies it. So why would it be okay if done by Generative AI? The product-specific terms and conditions of GitHub Copilot shift the responsibility for using any suggestions to you. The Qt Company can and will not take any responsibility for suggestions as GitHub Copilot serves us information in a black box method. Interestingly, GitHub is not interested in an IPR violation if the user has not activated "all filtering features available." At the time of writing, the filters not to use non-permissive, public open source software are deactivated by default.

​Generative AI只是一种清洗非许可开源代码的自动化方式吗?什么程度的次要理由使非许可、非版权代码的“副本”(如根据通用公共许可(GPL)条款)可以被接受为新的知识产权?变量名称的更改或变量的不同声明是否足够?如果人类手动修改它,这将不被视为足够的改变。那么,如果由Generative AI完成,为什么会没事呢?GitHub Copilot的产品特定条款和条件将使用任何建议的责任转移给您。由于GitHub Copilot以黑匣子的方式为我们提供信息,Qt公司可以也不会对建议承担任何责任。有趣的是,如果用户没有激活“所有可用的过滤功能”,GitHub对侵犯知识产权不感兴趣。在撰写本文时,默认情况下,不使用非许可公共开源软件的过滤器会被停用。

We at Qt recommend carefully evaluating the terms and conditions related to using any Generative AI, both for open source and commercial use.

我们Qt建议仔细评估与使用任何Generative AI相关的条款和条件,包括开源和商业用途。

We do recommend turning on the filters and screening for suggestions from non-permissive open source code before using the service. Playing around with GitHub Copilot might be fun without the filters being activated momentarily. Still, we recommend, just like GitHub does indirectly in the terms and conditions, to only create product code with all filters applied. Don’t get us wrong: We at Qt love it when adopting a new programming language is easier, and productivity is higher with smart suggestions. However, we don't want it to be done at the expense of intellectual property. In case of doubt, do not use a particular suggestion from Generative AI or try to use some of the millions of lines of QML and C++ code of the Qt framework software libraries, which can be fully commercially supported with a license.

我们建议在使用该服务之前打开过滤器并筛选来自非许可开源代码的建议。如果不立即激活过滤器,玩GitHub Copilot可能会很有趣。尽管如此,我们还是建议,就像GitHub在条款和条件中间接做的那样,只创建应用了所有过滤器的产品代码。不要误解我们的意思:我们Qt喜欢采用一种新的编程语言更容易,而且通过明智的建议可以提高生产力。然而,我们不希望以牺牲知识产权为代价。如果有疑问,不要使用Generative AI的特定建议,也不要尝试使用Qt框架软件库的数百万行QML和C++代码中的一些,这些代码可以通过许可证得到充分的商业支持。

Furthermore, we recommend not allowing GitHub Copilot to use snippets or suggestions for your code to be used to train the AI algorithm. That might be the strongest, yet not perfect, way to prevent you see your code with a small modification being suggested to somebody else.

此外,我们建议不要允许GitHub Copilot使用代码片段或建议来训练AI算法。这可能是最有力但并不完美的方法,可以防止你看到你的代码,并向其他人建议进行小的修改。

在Qt中引入Generative AI_第2张图片

 

GitHub Copilot integration to Qt in Technical Preview

GitHub Copilot技术预览版与Qt的集成


If you want to try it for yourself already, at your own risk as usual, even before Qt Creator 11 is done, then you can download the latest Qt Creator snapshot from us. You need a GitHub Copilot subscription to use it. You need to download some files and place them in the required folders according to the README text. You can activate GitHub Copilot across all Qt Creator or only project-specific. Remember to activate all filters in the GitHub Copilot settings. The target is to release Qt Creator 11 at the end of July.

​如果你想像往常一样,甚至在Qt Creator 11完成之前,就已经自己尝试了,风险自负,那么可以从我们这里下载最新的Qt Creaator快照。需要订阅GitHub Copilot才能使用它。需要下载一些文件,并根据README文本将它们放在所需的文件夹中。可以在所有Qt Creator中激活GitHub Copilot,也可以仅激活特定项目。请记住激活GitHub Copilot设置中的所有筛选器。目标是在7月底发布Qt Creator 11。

As mentioned before, we are providing the GitHub Copilot integration as Technical Preview to collect feedback from you, the users of the Qt Creator. What use cases of generative AI would you like to see from Qt in the future? Would you like us to release the GitHub Copilot integration as a feature instead of Technical Preview? Would you rather see us integrating Codeium to use only permissive code to train the algorithm? Or would you instead want the Qt community to develop its own Language Learning Model (LLM) to be used directly with OpenAI? Let us know. For example, you can drop your suggestions in the comments below.

如前所述,我们将提供GitHub Copilot集成作为技术预览,以收集(Qt Creator的用户)的反馈。希望在未来从Qt中看到生成人工智能的哪些用例?希望我们将GitHub Copilot集成作为一项功能而不是技术预览发布吗?你宁愿看到我们集成Codeium,只使用许可代码来训练算法吗?或者你会希望Qt社区开发自己的语言学习模型(LLM),直接与OpenAI一起使用吗?让我们知道。例如,可以在下面的评论中删除您的建议。

你可能感兴趣的:(QtBlog,qt)