-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New PF Tool: Open_Source_llm - Dev, Test, & Documentation (#531)
# Description The open_source_llm PromptFlow tool. This tool allows users to access their Online Endpoint deployment of the Falcon, LlaMa-2, Dolly, and GTP-2 models from the Azure Machine Learning Model Catalog. More models to This PR includes the full functionality of the open_source_llm tool, along with quality assurance tests, documentation, and supporting common code. Screenshots for the tools appearance in VsCode and local test pass results follow. # 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.** - [x] **I have read the [contribution guidelines](../CONTRIBUTING.md).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] 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 - [x] Pull request includes test coverage for the included changes. ### Screen Shot in VsCode <img width="436" alt="image" src="https://github.com/microsoft/promptflow/assets/99283778/6f6a632b-c584-4df6-9adf-66cb008d7f0c"> ### Tests <img width="212" alt="image" src="https://github.com/microsoft/promptflow/assets/99283778/a92579e5-c380-4008-91f2-e85df7f5b484"> --------- Co-authored-by: chjinche <49483542+chjinche@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
739 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -127,7 +127,8 @@ | |
"pysqlite", | ||
"AADSTS700082", | ||
"levelno", | ||
"LANCZOS" | ||
"LANCZOS", | ||
"Mobius" | ||
], | ||
"allowCompoundWords": true | ||
} |
Binary file added
BIN
+69.5 KB
docs/media/reference/tools-reference/open_source_llm_on_vscode_promptflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Open Source LLM | ||
|
||
## Introduction | ||
|
||
The Prompt flow Open Source LLM tool enables you to utilize a variety of Open Source and Foundational Models, such as [Falcon](https://aka.ms/AAlc25c) or [Llama 2](https://aka.ms/AAlc258) for natural language processing, in PromptFlow. | ||
|
||
Here's how it looks in action on the Visual Studio Code Prompt flow extension. In this example, the tool is being used to call a LlaMa-2 chat endpoint and asking "What is CI?". | ||
|
||
![Screenshot of the Open Source Llm On vsCode PromptFlow extension](../../media/reference/tools-reference/open_source_llm_on_vscode_promptflow.png) | ||
|
||
This Prompt flow supports two different LLM API types: | ||
|
||
- **Chat**: Shown in the example above. The chat API type facilitates interactive conversations with text-based inputs and responses. | ||
- **Completion**: The Completion API type is used to generate single response text completions based on provided prompt input. | ||
|
||
## Quick Overview: How do I use Open Source LLM Tool? | ||
|
||
1. Choose a Model from the AzureML Model Catalog and deploy. | ||
2. Setup and select the connections to the model deployment. | ||
3. Configure the tool with the model settings. | ||
4. Prepare the Prompt with [guidance](./prompt-tool.md#how-to-write-prompt). | ||
5. Run the flow. | ||
|
||
## Prerequisites: Model Deployment | ||
|
||
1. Pick the model which matched your scenario from the [Azure Machine Learning model catalog](https://ml.azure.com/model/catalog). | ||
2. Use the "Deploy" button to deploy the model to a AzureML Online Inference endpoint. | ||
|
||
More detailed instructions can be found here [Deploying foundation models to endpoints for inferencing.](https://learn.microsoft.com/en-us/azure/machine-learning/how-to-use-foundation-models?view=azureml-api-2#deploying-foundation-models-to-endpoints-for-inferencing) | ||
|
||
## Prerequisites: Prompt flow Connections | ||
|
||
In order for Prompt flow to use your deployed model, you will need to setup a Connection. Explicitly, the Open Source LLM tool uses the CustomConnection. | ||
|
||
1. Instructions to create a Custom Connection [can be found here.](https://microsoft.github.io/promptflow/how-to-guides/manage-connections.html#create-a-connection) | ||
|
||
The keys to set are: | ||
|
||
1. **endpoint_url** | ||
- This value can be found at the previously created Inferencing endpoint. | ||
2. **endpoint_api_key** | ||
- Ensure to set this as a secret value. | ||
- This value can be found at the previously created Inferencing endpoint. | ||
3. **model_family** | ||
- Supported values: LLAMA, DOLLY, GPT2, or FALCON | ||
- This value is dependent on the type of deployment you are targetting. | ||
|
||
## Running the Tool: Inputs | ||
|
||
The Open Source LLM tool has a number of parameters, some of which are required. Please see the below table for details, you can match these to the screen shot above for visual clarity. | ||
|
||
| Name | Type | Description | Required | | ||
|------|------|-------------|----------| | ||
| api | string | This is the API mode and will depend on the model used and the scenario selected. *Supported values: (Completion \| Chat)* | Yes | | ||
| connection | CustomConnection | This is the name of the connection which points to the Online Inferencing endpoint. | Yes | | ||
| model_kwargs | dictionary | This input is used to provide configuration specific to the model used. For example, the Llama-02 model may use {\"temperature\":0.4}. *Default: {}* | No | | ||
| deployment_name | string | The name of the deployment to target on the Online Inferencing endpoint. If no value is passed, the Inferencing load balancer traffic settings will be used. | No | | ||
| prompt | string | The text prompt that the language model will use to generate it's response. | Yes | | ||
|
||
## Outputs | ||
|
||
| API | Return Type | Description | | ||
|------------|-------------|------------------------------------------| | ||
| Completion | string | The text of one predicted completion | | ||
| Chat | string | The text of one response int the conversation | |
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
Oops, something went wrong.