SIGN IN SIGN UP

Integrate cutting-edge LLM technology quickly and easily into your apps

0 0 26 C#
Python: rebuilt exceptions structure; pythonic version (#5231) ### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
# Copyright (c) Microsoft. All rights reserved.
Python: Introduce the non-chat, non-streaming OpenAIAssistantAgent, samples, and tests (#7477) ### Motivation and Context To align with SK dotnet and to allow SK Python devs to leverage the OpenAI/Azure OpenAI assistants, this code is a required component for SK Python. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description We're introducing the code to build non-chat, non-streaming OpenAIAssistantAgents for both the OpenAI and Azure OpenAI styles. This PR introduces: - The required code to create OpenAI/AzureOpenAI assistants using the v2 library. - Samples showing how to create the agent, and how to use the tool resources like the code interpreter and file search. - Unit test coverage at 100% - Full mypy coverage - Closes #7080 ![image](https://github.com/user-attachments/assets/1c874710-067d-435e-9382-975d3697a16a) One to-do item: - introduce Agent integration tests Note: streaming assistant agent support will come in the next PR. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone :smile:
2024-08-01 09:45:06 -04:00
from semantic_kernel.exceptions.agent_exceptions import * # noqa: F403
from semantic_kernel.exceptions.content_exceptions import * # noqa: F403
from semantic_kernel.exceptions.filter_exceptions import * # noqa: F403
from semantic_kernel.exceptions.function_exceptions import * # noqa: F403
from semantic_kernel.exceptions.kernel_exceptions import * # noqa: F403
from semantic_kernel.exceptions.memory_connector_exceptions import * # noqa: F403
Python: Add the Python process framework (#9363) ### Motivation and Context An initial PR to add the foundational pieces of the Python Process framework, which holds it design to be similar to dotnet in that step types are added to a process builder, and later on, when the step is run, it is first instantiated and the proper state is provided. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description Adding the initial process framework components: - Closes #9354 **TODO** - more unit tests will be added to increase the code coverage. Currently there are several files with no (or low) code coverage. - more samples will either be added to this PR or a subsequent PR <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone :smile:
2024-10-24 13:37:45 -04:00
from semantic_kernel.exceptions.process_exceptions import * # noqa: F403
Python: Introducing vector and text search (#9345) ### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> This PR does the following things: - Introduces TextSearch abstractions, including implementation for Bing - This consists of the TextSearch class, which implements three public search methods, and handles the internals, the search methods are: 'search' returns a string, 'get_text_search_results' returns a TextSearchResult object and 'get_search_results' returns a object native to the search service (i.e. BingWebPages for Bing) - This also has a method called "create_{search_method}' which returns a KernelFunction based on the search method. This function can be adapted by setting the parameters and has several adaptability options and allows you to create a RAG pipeline easily with custom names and descriptions of both the functions and the parameters! - Introduces VectorSearch abstractions, including implementation for Azure AI Search - This consists of a VectorStoreBase class which handles all the internal and three public interfaces, vectorized_search (supply a vector), vectorizable_text_search (supply a string that get's vectorized downstream), vector_text_search (supply a string), each vector store record collection can pick and choose which ones they need to support by importing one or more next to the VectorSearchBase class. - Introduces VectorStoreTextSearch as a way to leverage text search against vector stores - Since this builds on TextSearch this is now the best way to create a super powerfull RAG setup with your own data model! - Adds all the related classes, samples and tests for the above. - Also reorders the data folder, which might cause some slight breaking changes for the few stores that have the new vector store model. - Adds additional IndexKinds and DistanceFunctions to stay in sync with dotnet. - Renames VolatileStore and VolatileCollection to InMemoryVectorStore and InMemoryVectorCollection. Closes #6832 #6833 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile: --------- Co-authored-by: Tao Chen <taochen@microsoft.com>
2024-11-06 14:22:50 +01:00
from semantic_kernel.exceptions.search_exceptions import * # noqa: F403
from semantic_kernel.exceptions.service_exceptions import * # noqa: F403
from semantic_kernel.exceptions.template_engine_exceptions import * # noqa: F403
from semantic_kernel.exceptions.vector_store_exceptions import * # noqa: F403