-
Notifications
You must be signed in to change notification settings - Fork 913
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: chat ui need to infer signature of csharp (#2898)
# Description 1. fix for csharp flex flow chat ui. 2. refactor current csharp tests - give them a specific marker and skip the marker in regular tests Hard to add corresponding tests for now given it's wired to do a copy for all api test utils/conftest # All Promptflow Contribution checklist: - [x] **The pull request does not introduce [breaking changes].** - [x] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
- Loading branch information
Showing
19 changed files
with
1,005 additions
and
270 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
.github/pipelines/promptflow-csharp-e2e-test-env-setup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
parameters: | ||
- name: promptflowCsPat | ||
displayName: "PAT to clone csharp repository" | ||
type: string | ||
- name: flowProjectRelativePath | ||
displayName: "Flow Project Relative Path" | ||
type: string | ||
|
||
steps: | ||
- task: UseDotNet@2 | ||
inputs: | ||
version: '6.x' | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.9.x' | ||
architecture: 'x64' | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Install promptflow cli' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
Set-PSDebug -Trace 1 | ||
pip install -r src/promptflow/dev_requirements.txt | ||
pip install src/promptflow-tracing | ||
pip install src/promptflow-core[executor-service] | ||
pip install src/promptflow-devkit | ||
pip install src/promptflow-azure | ||
pip install src/promptflow-recording | ||
pip freeze | ||
- task: PowerShell@2 | ||
displayName: 'Clone csharp repository' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
git clone https://$(PROMPTFLOW_CS_PAT)@dev.azure.com/msdata/Vienna/_git/PromptflowCS csharp | ||
- task: NuGetAuthenticate@1 | ||
|
||
- task: DotNetCoreCLI@2 | ||
inputs: | ||
command: 'restore' | ||
projects: '$(flowProjectRelativePath)/**/*.csproj' | ||
feedsToUse: 'config' | ||
nugetConfigPath: '$(flowProjectRelativePath)/nuget.config' | ||
displayName: 'dotnet restore' | ||
|
||
- task: DotNetCoreCLI@2 | ||
inputs: | ||
command: 'build' | ||
projects: '$(flowProjectRelativePath)/**/*.csproj' | ||
feedsToUse: 'config' | ||
nugetConfigPath: '$(flowProjectRelativePath)/nuget.config' | ||
displayName: 'dotnet build' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
parameters: | ||
- name: azureOpenAiApiKey | ||
displayName: "Azure OpenAI API Key" | ||
type: string | ||
- name: azureOpenAiApiBase | ||
displayName: "Azure OpenAI API Base" | ||
type: string | ||
- name: flowProjectRelativePath | ||
displayName: "Flow Project Relative Path" | ||
type: string | ||
|
||
steps: | ||
- task: PowerShell@2 | ||
displayName: 'Copy local connections for ci pipeline' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
Copy-Item dev-connections.json.example connections.json | ||
workingDirectory: $(Build.SourcesDirectory)/src/promptflow | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Run sdk cli tests' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
pytest tests/ -m "csharp" | ||
workingDirectory: $(Build.SourcesDirectory)/src/promptflow-devkit | ||
env: | ||
CSHARP_TEST_PROJECTS_ROOT: $(Build.SourcesDirectory)/$(flowProjectRelativePath) | ||
AZURE_OPENAI_API_KEY: $(azureOpenAiApiKey) | ||
AZURE_OPENAI_ENDPOINT: $(azureOpenAiApiBase) | ||
IS_IN_CI_PIPELINE: true | ||
|
||
# enable this after we fix recording issue | ||
#- task: PowerShell@2 | ||
# displayName: 'Run azure sdk cli tests' | ||
# inputs: | ||
# targetType: 'inline' | ||
# script: | | ||
# pytest tests/sdk_cli_azure_test/e2etests/test_csharp_sdk.py | ||
# workingDirectory: $(Build.SourcesDirectory)/src/promptflow-azure | ||
# env: | ||
# CSHARP_TEST_PROJECTS_ROOT: $(Build.SourcesDirectory)/$(flowProjectRelativePath) | ||
# AZURE_OPENAI_API_KEY: $(azureOpenAiApiKey) | ||
# AZURE_OPENAI_ENDPOINT: $(azureOpenAiApiBase) | ||
# PROMPT_FLOW_TEST_MODE: "replay" | ||
# IS_IN_CI_PIPELINE: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/promptflow-azure/tests/sdk_cli_azure_test/e2etests/test_csharp_cli.py
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/promptflow-azure/tests/sdk_cli_azure_test/e2etests/test_csharp_sdk.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# --------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# --------------------------------------------------------- | ||
|
||
from typing import Callable | ||
|
||
import pytest | ||
|
||
from promptflow._sdk.entities import Run | ||
from promptflow.azure import PFClient | ||
|
||
from .._azure_utils import DEFAULT_TEST_TIMEOUT, PYTEST_TIMEOUT_METHOD | ||
|
||
|
||
@pytest.mark.timeout(timeout=DEFAULT_TEST_TIMEOUT, method=PYTEST_TIMEOUT_METHOD) | ||
@pytest.mark.e2etest | ||
@pytest.mark.csharp | ||
@pytest.mark.usefixtures( | ||
"mock_set_headers_with_user_aml_token", | ||
"single_worker_thread_pool", | ||
"vcr_recording", | ||
) | ||
class TestCSharpSdk: | ||
def test_basic_run_bulk(self, pf: PFClient, randstr: Callable[[str], str], csharp_test_project_basic): | ||
name = randstr("name") | ||
|
||
run = pf.run( | ||
flow=csharp_test_project_basic["flow_dir"], | ||
data=csharp_test_project_basic["data"], | ||
name=name, | ||
) | ||
assert isinstance(run, Run) | ||
assert run.name == name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.