December 2nd, 2024

使用Semantic Kernel来开启您的AI旅程

Semantic Kernel (SK) 是由微软开发的一款开源开发工具包,旨在帮助开发者和企业利用最新的人工智能技术构建更智能和复杂的AI驱动解决方案,例如检索增强生成 (RAG) 和智能体 (Agent)。

Image Semantic Kernel and the art of teamwork

核心概念

内核(Kernel)

您可以将SK的内核视为一个容器,该容器包含您所需的所有与AI相关的组件,如提示语模板、AI服务和插件。如果将所有的服务和插件提供给内核,则AI会根据需求自动使用它们。SK还提供多项企业级功能,使您可以保证您的AI符合安全要求且在部署后能够持续监控AI的表现。

提示语(Prompt Engineering)

提示语在使用大型语言模型中至关重要。优质的提示语能够显著提升用户体验。SK通过提示语模板(template)的方式来实现自然语言与AI插件的混合使用,让您的提示语变得更加的灵活。

AI服务(AI Services)

SK支持多种AI应用场景,包括对话补全,文本生成,嵌入(embedding)生成,图像与文字转换,以及音频与文字转换。此外,SK兼容多个AI服务提供商,如OpenAI,Azure,Google AI, Amazon Bedrock, 以及提供本地推理服务的Ollama等。

插件(Plugins/Functions)

SK通过插件支持扩展大型语言模型的功能。插件可以是代码或自然语言,并可集成外部系统,如数据库、API或其他云服务,以便AI解决方案获取动态信息。

矢量存储(Vector Stores)

矢量存储可以被视为存储嵌入的数据库。许多现代数据库已开始提供矢量存储服务,这在构建RAG方案的检索步骤中扮演着重要角色。SK支持市场上大部分的矢量数据库,比如说Azure AI SearchAzure Cosmos DBQdrantRedis, 和Weaviate等。

企业组件(Enterprise Components)

SK自项目启动之初便将企业级AI解决方案作为首要目标。SK提供一系列功能以增强AI的安全性,包括筛选器(Filter)和可观察性(Observability)。筛选器可用于过滤提示语,确保不处理不安全的提示,并在生成式AI的回答到达终端用户前进行适当过滤。可观察性确保您在将AI部署到分布式系统时,仍能了解系统内部的运行状态,包括token的使用情况、函数的运行时间、以及大型语言模型的输入输出等。

框架

除了上述核心功能外,SK还提供以下框架,以帮助您构建更复杂的AI解决方案:

  • 智能体框架:利用了SK生态创建和管理AI智能体。
  • 业务流框架:利用了SK生态使企业能更有效地创建,管理和部署完整的AI业务流程。

关于这两个框架的详细介绍,我将在后续文章中单独阐述,敬请期待!

开始使用

目前,SK支持三种编程语言:C#,Python,和Java。SK的源代码托管在GitHub上。您可以访问我们的仓库以获取源代码,文档和开发示例:

我们还有全面的文档:

我们会定期通过博客分享项目进展和用户案例:Semantic Kernel | The latest news from the Semantic Kernel team for developers

总结

SK是一个开源的AI开发工具包,致力于为开发者和企业的AI转型提供前沿和可靠的技术支持。本次分享介绍了SK的核心概念和AI框架。我们鼓励开发者和企业利用SK探索并构建更多创新应用。如果在使用过程中遇到问题或有疑问,请在Semantic Kernel GitHub讨论频道中向我们反馈。如果您对此项目感兴趣,我们也欢迎您的技术贡献。期待您的问题和反馈!


Content from above in English

Use Semantic Kernel to Start your AI Journey

Semantic Kernel (SK) is an open-source SDK developed by Microsoft, designed to help developers and enterprises leverage the latest artificial intelligence technologies to build smarter and more complex AI-driven solutions, such as Retrieval Augmented Generation (RAG) and Agents.

Core Concepts

Kernel

You can think of the SK kernel as a container that includes all the AI-related components needed for your solution, such as prompt templates, AI services, and plugins. SK also includes many enterprise-level features that ensure AI safety requirements and allow you to continuously monitor the performance of your AI after deploying your solution.

Prompt Engineering

Prompting is crucial when using large language models. High-quality prompts can significantly enhance the user experience. SK implements flexible usage of natural language and AI plugins through prompt templates, making your prompts more adaptable.

AI Services

SK supports a wide range of AI application scenarios, including chat completion, text completion, embedding generation, image-to-text, text-to-image, audio-to-text, and text-to-audio. Additionally, SK is compatible with multiple AI service providers, such as OpenAI, Azure, Google AI, Amazon Bedrock, and Ollama, which offers local inference services.

Plugins/Functions

SK extends the functionality of large language models through plugin support. Plugins can be code or natural language and can integrate with external systems, such as databases, APIs, or other cloud services, enabling your AI solution to access real-time information.

Vector Stores

You can think of vector storage as a database for storing embeddings. Many modern databases have begun to offer vector storage services, playing a crucial role in the retrieval step of RAG solutions. SK supports most vector databases available in the market, including Azure AI Search, Azure Cosmos DB, Qdrant, Redis, and Weaviate.

Enterprise Components

From its inception, SK has prioritized enterprise-level AI solutions. SK offers a range of features to enhance the security of your AI, including filters and observability. Filters can be used to screen prompts, ensuring that your solution does not process unsafe prompts and that inappropriate responses from generative AI are filtered before reaching end users. Observability ensures that you can still understand the internal state of your system, such as token usage, function runtimes, and the input/output of large language models, even when your AI is deployed in a distributed system.

Frameworks

In addition to the core functionalities mentioned above, SK provides the following frameworks to assist you in building more complex AI solutions:

  • Agent Framework: This framework utilizes the SK ecosystem to create and manage AI agents.
  • Process Framework: This framework leverages the SK ecosystem to enable enterprises to more effectively create, manage, and deploy complete AI business processes.

I will provide a detailed introduction to these two frameworks in separate articles, so please stay tuned!

Getting Started

Currently, SK supports three programming languages: C#, Python, and Java. SK is hosted on GitHub, where you can access our repository for source code, documentation, and development samples:

We also provide comprehensive documentation:

We will regularly share project updates and user cases through our blog: Semantic Kernel | The latest news from the Semantic Kernel team for developers

Conclusion

The Semantic Kernel team is dedicated to empowering developers by providing access to the latest advancements in the industry. We encourage you to leverage your creativity and build remarkable solutions with SK! Please reach out if you have any questions or feedback through our Semantic Kernel GitHub Discussion Channel. We look forward to hearing from you! We would also love your support, if you’ve enjoyed using Semantic Kernel, give us a star on GitHub.

 

0 comments