Python: cleanup/sync/fixes (for examples, docs, tests, notebooks) (#317)
### Motivation and Context
The `python-preview` branch is under active development and many
docs/tests/examples are getting a bit out of sync. There are also a few
small cleanup chores/refactors to make _usage_ easier (e.g., to make
examples cleaner). I've grouped these small fixes (plus a few bug fixes)
into this "cleanup" PR.
### Description
This PR does the following:
1. Updates the out-of-date example in `README.md`
2. Fixes all 5 of the notebooks we support right now (1,2,3,4, and 6;
notebook 5 is planner, I've blanked out most of the code there so we
don't confuse people, especially as the planner API is changing)
3. Fixes a bug w/ `stop_sequences` in `(Azure)OpenAITextCompletion`
4. Fixes a bug introduced in our upgrades to the embeddings cosine-sim
check (we should add more thorough tests here)
5. Cleans up tests
6. Ensures end-to-end tests are all runnable
7. Fixes up the `kernel_extensions` to work more naturally (so that end
users can use them directly on the `kernel` object and get good
type-hinting)
2023-04-04 16:44:59 -05:00
|
|
|
OPENAI_API_KEY=""
|
2024-08-02 14:01:01 -07:00
|
|
|
OPENAI_CHAT_MODEL_ID=""
|
|
|
|
|
OPENAI_TEXT_MODEL_ID=""
|
|
|
|
|
OPENAI_EMBEDDING_MODEL_ID=""
|
Python: cleanup/sync/fixes (for examples, docs, tests, notebooks) (#317)
### Motivation and Context
The `python-preview` branch is under active development and many
docs/tests/examples are getting a bit out of sync. There are also a few
small cleanup chores/refactors to make _usage_ easier (e.g., to make
examples cleaner). I've grouped these small fixes (plus a few bug fixes)
into this "cleanup" PR.
### Description
This PR does the following:
1. Updates the out-of-date example in `README.md`
2. Fixes all 5 of the notebooks we support right now (1,2,3,4, and 6;
notebook 5 is planner, I've blanked out most of the code there so we
don't confuse people, especially as the planner API is changing)
3. Fixes a bug w/ `stop_sequences` in `(Azure)OpenAITextCompletion`
4. Fixes a bug introduced in our upgrades to the embeddings cosine-sim
check (we should add more thorough tests here)
5. Cleans up tests
6. Ensures end-to-end tests are all runnable
7. Fixes up the `kernel_extensions` to work more naturally (so that end
users can use them directly on the `kernel` object and get good
type-hinting)
2023-04-04 16:44:59 -05:00
|
|
|
OPENAI_ORG_ID=""
|
2024-06-11 11:28:12 -04:00
|
|
|
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=""
|
|
|
|
|
AZURE_OPENAI_TEXT_DEPLOYMENT_NAME=""
|
|
|
|
|
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME=""
|
2023-04-13 14:13:19 -07:00
|
|
|
AZURE_OPENAI_ENDPOINT=""
|
|
|
|
|
AZURE_OPENAI_API_KEY=""
|
2024-08-26 13:34:29 +02:00
|
|
|
AZURE_OPENAI_API_VERSION=""
|
2024-10-11 09:38:33 -04:00
|
|
|
AZURE_AI_SEARCH_ENDPOINT=""
|
|
|
|
|
AZURE_AI_SEARCH_SERVICE=""
|
|
|
|
|
AZURE_AI_SEARCH_API_KEY=""
|
|
|
|
|
AZURE_AI_SEARCH_INDEX_NAME=""
|
2023-10-02 17:25:28 -04:00
|
|
|
MONGODB_ATLAS_CONNECTION_STRING=""
|
2023-06-29 16:09:58 -04:00
|
|
|
PINECONE_API_KEY=""
|
|
|
|
|
PINECONE_ENVIRONMENT=""
|
2023-07-11 14:52:08 -07:00
|
|
|
POSTGRES_CONNECTION_STRING=""
|
2023-08-25 19:06:36 -04:00
|
|
|
WEAVIATE_URL=""
|
|
|
|
|
WEAVIATE_API_KEY=""
|
|
|
|
|
GOOGLE_SEARCH_ENGINE_ID=""
|
2025-04-21 15:46:31 +05:30
|
|
|
BRAVE_API_KEY=""
|
2023-08-31 13:38:16 -07:00
|
|
|
REDIS_CONNECTION_STRING=""
|
2024-08-26 13:34:29 +02:00
|
|
|
AZCOSMOS_API=""
|
|
|
|
|
AZCOSMOS_CONNSTR=""
|
|
|
|
|
AZCOSMOS_DATABASE_NAME=""
|
|
|
|
|
AZCOSMOS_CONTAINER_NAME=""
|
2024-04-22 19:40:39 +02:00
|
|
|
ASTRADB_APP_TOKEN=""
|
2024-01-30 16:51:04 -05:00
|
|
|
ASTRADB_ID=""
|
|
|
|
|
ASTRADB_REGION=""
|
Python: Add ACA Python Sessions (Code Interpreter) Core Plugin, samples, and tests (#6158)
### Motivation and Context
Adding a new core plugin to Semantic Kernel Python that leverages the
Azure Container Apps Python Sessions Container. This container allows
one, with the proper resource, to run Python in a safe, managed
environment.
<!-- 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
This PR introduces:
- The Python Sessions (code interpreter) plugin to execute code, upload
a file to the container, list files, and download files.
- It includes a README.md with the steps to set up the ACA resource.
- New samples to show use as a plugin and auto function calling
- Unit tests
<!-- 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-05-08 17:01:51 -04:00
|
|
|
ASTRADB_KEYSPACE=""
|
Python: Introduce Pydantic settings (#6193)
### Motivation and Context
SK Python is tightly coupled to the use of a `.env` file to read all
secrets, keys, endpoints, and more. This doesn't scale well for users
who wish to be able to use environment variables with their SK
Applications. By introducing Pydantic Settings, it is possible to use
both environment variables as well as have a fall-back to a `.env` file
(via a `env_file_path` parameter), if desired.
By introducing Pydantic Settings, we are removing the requirement to
have to create Text/Embedding/Chat completion objects with an `api_key`
or other previously required information (in the case of
AzureChatCompletion that means an `endpoint`, an `api_key`, a
`deployment_name`, and an `api_version`). When the AI connector is
created, the Pydantic settings are loaded either via env vars or the
fall-back `.env` file, and that means the user can create a chat
completion object like:
```python
chat_completion = OpenAIChatCompletion(service_id="test")
```
or, to optionally override the `ai_model_id` env var:
```python
chat_completion = OpenAIChatCompletion(service_id="test", ai_model_id="gpt-4-1106")
```
Note: we have left the ability to specific an `api_key`/`org_id` for
`OpenAIChatCompletion` or a `deployment_name`, `endpoint`, `base_url`,
and `api_version` for `AzureChatCompletion` as before, but if your
settings are configured to use env vars/.env file then there is no need
to pass this information.
<!-- 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
The PR introduces the use of Pydantic settings and removes the use of
the python-dotenv library.
- Closes #1779
- Updates notebooks, samples, code and tests to remove the explicit
config of api_key or other previous .env files values.
- Adds new unit test config using monkeypatch to simulate env variables
for testing
- All unit and integration tests passing
<!-- 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
- [ ] I didn't break anyone :smile:
2024-05-16 07:44:40 -04:00
|
|
|
ACA_POOL_MANAGEMENT_ENDPOINT=""
|
|
|
|
|
BOOKING_SAMPLE_CLIENT_ID=""
|
|
|
|
|
BOOKING_SAMPLE_TENANT_ID=""
|
|
|
|
|
BOOKING_SAMPLE_CLIENT_SECRET=""
|
|
|
|
|
BOOKING_SAMPLE_BUSINESS_ID=""
|
2025-02-12 20:19:14 -08:00
|
|
|
BOOKING_SAMPLE_SERVICE_ID=""
|
|
|
|
|
CREW_AI_ENDPOINT=""
|
|
|
|
|
CREW_AI_TOKEN=""
|