-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: ADR for new AI connector abstract methods #8430
Python: ADR for new AI connector abstract methods #8430
Conversation
docs/decisions/0052-python-ai-connector-new-abstract-methods.md
Outdated
Show resolved
Hide resolved
@TaoChenOSU i really like this ! With this we could potentially running FunctionCall in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, Tao, thanks for writing this up, I like the thinking, I've used a very similar setup for the new memory connectors, where the classes implement a _inner_*
method, while the get
, upsert
, etc methods are all default implemented in the base class, indeed makes it much simpler to implement a new one! One thing to add is a way to indicate which model can and can't do function calling, since the function call behavior is part of the base prompt execution settings and that is therefore not a way to distinguish!
That's great! I think a |
docs/decisions/0052-python-ai-connector-new-abstract-methods.md
Outdated
Show resolved
Hide resolved
### 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 implements: https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0052-python-ai-connector-new-abstract-methods.md (PR: #8430). ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> 1. Add abstract methods `_inner_get_chat_message_content` and `_inner_get_streaming_chat_message_content` to `ChatCompletionClientBase`. 2. Implement the abstractions in all chat completion connectors. 3. Add abstract methods `_inner_get_text_contents` and `_inner_get_streaming_text_contents` to `TextCompletionClientBase`. 4. Implement the abstractions in all text completion connectors. 5. Remove text completion APIs from `OllamaChatCompletion` (breaking changes). > No breaking changes on other connectors except Ollama, and public APIs stay the same. ### 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 😄
Motivation and Context
This ADR documents a proposal to introduce four new abstract methods in
ChatCompletionClientBase
andTextCompletionClientBase
to optimize code and further streamline the process of adding new AI connectors.Description
Contribution Checklist