mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
Bumps [weaviate-client](https://github.com/weaviate/weaviate-python-client) from 3.23.0 to 3.24.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/weaviate/weaviate-python-client/releases">weaviate-client's releases</a>.</em></p> <blockquote> <h2>v3.24.2</h2> <h2>What's Changed</h2> <ul> <li>add tenant to failed objects by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/572">weaviate/weaviate-python-client#572</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/weaviate/weaviate-python-client/compare/v3.24.1...v3.24.2">https://github.com/weaviate/weaviate-python-client/compare/v3.24.1...v3.24.2</a></p> <h2>v3.24.1</h2> <h2>What's Changed</h2> <ul> <li>Catch JsonDecodeException and raise exception with response content by <a href="https://github.com/dirkkul"><code>@dirkkul</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/456">weaviate/weaviate-python-client#456</a></li> <li>Update dependencies by <a href="https://github.com/dirkkul"><code>@dirkkul</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/466">weaviate/weaviate-python-client#466</a></li> <li>Fix weaviate.<strong>version</strong> by <a href="https://github.com/trengrj"><code>@trengrj</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/468">weaviate/weaviate-python-client#468</a></li> <li>Fix clientwide mypy errors by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/482">weaviate/weaviate-python-client#482</a></li> <li>Remove default offline scope from OIDC user+pw. Users of some identity services like Okta might need to readd this scope by <a href="https://github.com/dirkkul"><code>@dirkkul</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/489">weaviate/weaviate-python-client#489</a></li> <li>Ignore pypi read timeout by <a href="https://github.com/dirkkul"><code>@dirkkul</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/490">weaviate/weaviate-python-client#490</a></li> <li>Fix batch delete with operands by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/479">weaviate/weaviate-python-client#479</a></li> <li>Remove client-side schema validation as this caused to many problems by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/488">weaviate/weaviate-python-client#488</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/trengrj"><code>@trengrj</code></a> made their first contribution in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/468">weaviate/weaviate-python-client#468</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/weaviate/weaviate-python-client/compare/v3.23.2...v3.24.1">https://github.com/weaviate/weaviate-python-client/compare/v3.23.2...v3.24.1</a></p> <h2>v3.23.2</h2> <h2>What's Changed</h2> <ul> <li>fix <a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/449">gh-449</a> by <a href="https://github.com/StefanBogdan"><code>@StefanBogdan</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/450">weaviate/weaviate-python-client#450</a></li> <li>ensure client functionality is aligned with docs usage by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/452">weaviate/weaviate-python-client#452</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/weaviate/weaviate-python-client/compare/v3.23.1...v3.23.2">https://github.com/weaviate/weaviate-python-client/compare/v3.23.1...v3.23.2</a></p> <h2>v3.23.1</h2> <h2>What's Changed</h2> <ul> <li>Enable rerank-cohere module in EmbeddedWeaviate by <a href="https://github.com/dirkkul"><code>@dirkkul</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/442">weaviate/weaviate-python-client#442</a></li> <li>Fix batch objects where filter by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/443">weaviate/weaviate-python-client#443</a></li> <li>move client-side filter check and error from gql.get to batch.delete_objects by <a href="https://github.com/tsmith023"><code>@tsmith023</code></a> in <a href="https://redirect.github.com/weaviate/weaviate-python-client/pull/445">weaviate/weaviate-python-client#445</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/weaviate/weaviate-python-client/compare/v3.23.0...v3.23.1">https://github.com/weaviate/weaviate-python-client/compare/v3.23.0...v3.23.1</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/weaviate/weaviate-python-client/blob/main/docs/changelog.rst">weaviate-client's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <h2>Version 3.24.1</h2> <p>This patch version updates the <code>changelog.rst</code> that became stale over the last few releases</p> <h2>Version 3.24.0</h2> <p>This minor version includes:</p> <ul> <li>Small fixes and improvements throughout the codebase: <ul> <li>Catching and reraising of <code>JsonDecodeException</code> for users to catch</li> <li>Client-wide mypy error fixing and type hinting improvements</li> <li>Fix for where filter operands in <code>batch.delete_objects</code></li> <li>Removal of buggy client-side schema validation</li> <li>Package dependency updates</li> </ul> </li> </ul> <h2>Version 3.23.2</h2> <p>This patch version includes:</p> <ul> <li>Enforcing class name capitalization throughout the client</li> <li>Further fixes to where filtering with <code>ContainsAny/All</code></li> </ul> <h2>Version 3.23.1</h2> <p>This patch version includes:</p> <ul> <li>Enabling of <code>rerank-cohere</code> module in <code>EmbeddedWeaviate</code></li> <li>Fixes for where filtering between <code>query.get</code> over GraphQL and <code>batch.delete_objects</code> over REST</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/8da29dce3941f012fc8838aff8e60d1af02027cd"><code>8da29dc</code></a> Merge pull request <a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/572">#572</a> from weaviate/fix/add-tenant-to-batch-retries</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/a3a11ebca53cdd78c7e77b347f54902e84e8cc41"><code>a3a11eb</code></a> add tenant to failed objects</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/e5f5d85e56cd0c89513d129c772e55b6dd527661"><code>e5f5d85</code></a> Merge pull request <a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/499">#499</a> from weaviate/update-changelog</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/1371aa77e0c1a428b67e805844c9f4c31ed0659f"><code>1371aa7</code></a> update changelog</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/bfe46ef6f1b8c52be474a64ff53b6e1d6a42e897"><code>bfe46ef</code></a> Merge pull request <a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/498">#498</a> from weaviate/update-changelog</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/49cf20672d5eee92b4d9a9c190e715faeeee7dc3"><code>49cf206</code></a> update changelog</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/b95ac22f8dbcb8d18715ef6a6d525c243083a7b2"><code>b95ac22</code></a> Merge pull request <a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/488">#488</a> from weaviate/fix/<a href="https://redirect.github.com/weaviate/weaviate-python-client/issues/486">#486</a></li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/1ff9e7af47ec11989192280890001bd210573488"><code>1ff9e7a</code></a> completely remove schema validation code</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/f9868d1a827618896c856a9e5fee19d861732a21"><code>f9868d1</code></a> fix test</li> <li><a href="https://github.com/weaviate/weaviate-python-client/commit/fa59a056a9dc22c5b8395504382691d34ef30288"><code>fa59a05</code></a> remove all instances where schema is validated before update/create</li> <li>Additional commits viewable in <a href="https://github.com/weaviate/weaviate-python-client/compare/v3.23.0...v3.24.2">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dmytro Struk <[email protected]>
Get Started with Semantic Kernel ⚡
Install the latest package:
python -m pip install --upgrade semantic-kernel
AI Services
OpenAI / Azure OpenAI API keys
Make sure you have an OpenAI API Key or Azure OpenAI service key
Copy those keys into a .env file (see the .env.example file):
OPENAI_API_KEY=""
OPENAI_ORG_ID=""
AZURE_OPENAI_DEPLOYMENT_NAME=""
AZURE_OPENAI_ENDPOINT=""
AZURE_OPENAI_API_KEY=""
Running a prompt
import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion, AzureChatCompletion
kernel = sk.Kernel()
# Prepare OpenAI service using credentials stored in the `.env` file
api_key, org_id = sk.openai_settings_from_dot_env()
kernel.add_chat_service("chat-gpt", OpenAIChatCompletion("gpt-3.5-turbo", api_key, org_id))
# Alternative using Azure:
# deployment, api_key, endpoint = sk.azure_openai_settings_from_dot_env()
# kernel.add_chat_service("dv", AzureChatCompletion(deployment, endpoint, api_key))
# Wrap your prompt in a function
prompt = kernel.create_semantic_function("""
1) A robot may not injure a human being or, through inaction,
allow a human being to come to harm.
2) A robot must obey orders given it by human beings except where
such orders would conflict with the First Law.
3) A robot must protect its own existence as long as such protection
does not conflict with the First or Second Law.
Give me the TLDR in exactly 5 words.""")
# Run your prompt
print(prompt()) # => Robots must not harm humans.
Semantic functions are Prompts with input parameters
# Create a reusable function with one input parameter
summarize = kernel.create_semantic_function("{{$input}}\n\nOne line TLDR with the fewest words.")
# Summarize the laws of thermodynamics
print(summarize("""
1st Law of Thermodynamics - Energy cannot be created or destroyed.
2nd Law of Thermodynamics - For a spontaneous process, the entropy of the universe increases.
3rd Law of Thermodynamics - A perfect crystal at zero Kelvin has zero entropy."""))
# Summarize the laws of motion
print(summarize("""
1. An object at rest remains at rest, and an object in motion remains in motion at constant speed and in a straight line unless acted on by an unbalanced force.
2. The acceleration of an object depends on the mass of the object and the amount of force applied.
3. Whenever one object exerts a force on another object, the second object exerts an equal and opposite on the first."""))
# Summarize the law of universal gravitation
print(summarize("""
Every point mass attracts every single other point mass by a force acting along the line intersecting both points.
The force is proportional to the product of the two masses and inversely proportional to the square of the distance between them."""))
# Output:
# > Energy conserved, entropy increases, zero entropy at 0K.
# > Objects move in response to forces.
# > Gravitational force between two point masses is inversely proportional to the square of the distance between them.
Semantic Kernel Notebooks
The repository contains a few Python and C# notebooks that demonstrates how to get started with the Semantic Kernel.
Python notebooks:
- Getting started with Semantic Kernel
- Loading and configuring Semantic Kernel
- Running AI prompts from file
- Creating Semantic Functions at runtime (i.e. inline functions)
- Using Context Variables to Build a Chat Experience
- Introduction to planners
- Building Memory with Embeddings
- Using Hugging Face for Skills
- Combining native functions and semantic functions
- Groundedness Checking with Semantic Kernel
- Returning multiple results per prompt
- Streaming completions with Semantic Kernel
SK Frequently Asked Questions
How does Python SK compare to the C# version of Semantic Kernel?
The two SDKs are compatible and at the core they follow the same design principles. Some features are still available only in the C# version, and being ported Refer to the FEATURE MATRIX doc to see where things stand in matching the features and functionality of the main SK branch. Over time there will be some features available only in the Python version, and others only in the C# version, for example adapters to external services, scientific libraries, etc.