Skip to content

Commit d0558f7

Browse files
authored
Merge pull request #261577 from ChenJieting/jieting/tool_doc_updates
[prompt flow tool reference] rename the open source llm tool to open model llm tool
2 parents ebd506e + ed874a5 commit d0558f7

File tree

7 files changed

+110
-81
lines changed

7 files changed

+110
-81
lines changed

articles/machine-learning/.openpublishing.redirection.machine-learning.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4214,6 +4214,11 @@
42144214
"source_path_from_root": "/articles/machine-learning/prompt-flow/tools-reference/more-tools.md",
42154215
"redirect_url": "/azure/machine-learning/prompt-flow/tools-reference/overview",
42164216
"redirect_document_id": false
4217+
},
4218+
{
4219+
"source_path_from_root": "/articles/machine-learning/prompt-flow/tools-reference/open-source-llm-tool.md",
4220+
"redirect_url": "/azure/machine-learning/prompt-flow/tools-reference/open-model-llm-tool",
4221+
"redirect_document_id": false
42174222
}
42184223
]
42194224
}
Loading
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: Open Model LLM tool in Azure Machine Learning prompt flow
3+
titleSuffix: Azure Machine Learning
4+
description: The prompt flow Open Model LLM tool enables you to utilize various open-source and foundational models.
5+
services: machine-learning
6+
ms.service: machine-learning
7+
ms.subservice: prompt-flow
8+
ms.custom: ignite-2023
9+
ms.topic: reference
10+
author: gjwoods
11+
ms.author: GEWOODS
12+
ms.reviewer: lagayhar
13+
ms.date: 11/02/2023
14+
---
15+
16+
# Open Model LLM tool
17+
18+
The Open Model LLM tool enables the utilization of various Open Model and Foundational Models, such as [Falcon](https://ml.azure.com/models/tiiuae-falcon-7b/version/4/catalog/registry/azureml) and [Llama 2](https://ml.azure.com/models/Llama-2-7b-chat/version/14/catalog/registry/azureml-meta), for natural language processing in Azure Machine Learning prompt flow.
19+
20+
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?".
21+
22+
:::image type="content" source="./media/open-model-llm-tool/open-model-llm-on-vscode-prompt-flow.png" alt-text="Screenshot that shows the Open Model LLM tool on Visual Studio Code prompt flow extension." lightbox = "./media/open-model-llm-tool/open-model-llm-on-vscode-prompt-flow.png":::
23+
24+
This prompt flow tool supports two different LLM API types:
25+
26+
- **Chat**: Shown in the preceding example. The chat API type facilitates interactive conversations with text-based inputs and responses.
27+
- **Completion**: The Completion API type is used to generate single response text completions based on provided prompt input.
28+
29+
## Quick overview: How do I use the Open Model LLM tool?
30+
31+
1. Choose a model from the Azure Machine Learning Model Catalog and get it deployed.
32+
2. Connect to the model deployment.
33+
3. Configure the open model llm tool settings.
34+
4. [Prepare the prompt](./prompt-tool.md#write-a-prompt).
35+
5. Run the flow.
36+
37+
## Prerequisites: Model deployment
38+
39+
- Pick the model that matched your scenario from the [Azure Machine Learning model catalog](https://ml.azure.com/model/catalog).
40+
- Use the **Deploy** button to deploy the model to an Azure Machine Learning online inference endpoint.
41+
- Use one of the Pay as you go deployment options.
42+
43+
To learn more, see [Deploy foundation models to endpoints for inferencing](../../how-to-use-foundation-models.md#deploying-foundation-models-to-endpoints-for-inferencing).
44+
45+
## Prerequisites: Connect to the model
46+
47+
In order for prompt flow to use your deployed model, you need to connect to it. There are several ways to connect.
48+
49+
### Endpoint connections
50+
51+
Once your flow is associated to an Azure Machine Learning or Azure AI Studio workspace, the Open Model LLM tool can use the endpoints on that workspace.
52+
53+
- **Using Azure Machine Learning or Azure AI Studio workspaces**: If you're using prompt flow in one of the web page based browsers workspaces, the online endpoints available on that workspace who up automatically.
54+
55+
- **Using VS Code or code first**: If you're using prompt flow in VS Code or one of the Code First offerings, you need to connect to the workspace. The Open Model LLM tool uses the azure.identity DefaultAzureCredential client for authorization. One way is through [setting environment credential values](https://learn.microsoft.com/python/api/azure-identity/azure.identity.environmentcredential).
56+
57+
### Custom connections
58+
59+
The Open Model LLM tool uses the CustomConnection. Prompt flow supports two types of connections:
60+
61+
- **Workspace connections** - Connections that are stored as secrets on an Azure Machine Learning workspace. While these connections can be used, in many places, the are commonly created and maintained in the Studio UI.
62+
63+
- **Local connections** - Connections that are stored locally on your machine. These connections aren't available in the Studio UX, but can be used with the VS Code extension.
64+
65+
To learn how to create a workspace or local Custom Connection, see [Create a connection](https://microsoft.github.io/promptflow/how-to-guides/manage-connections.html#create-a-connection).
66+
67+
The required keys to set are:
68+
69+
- **endpoint_url**
70+
- This value can be found at the previously created Inferencing endpoint.
71+
- **endpoint_api_key**
72+
- Ensure to set it as a secret value.
73+
- This value can be found at the previously created Inferencing endpoint.
74+
- **model_family**
75+
- Supported values: LLAMA, DOLLY, GPT2, or FALCON
76+
- This value is dependent on the type of deployment you're targeting.
77+
78+
## Running the tool: Inputs
79+
80+
The Open Model LLM tool has many parameters, some of which are required. See the following table for details, you can match these parameters to the preceding screenshot for visual clarity.
81+
82+
| Name | Type | Description | Required |
83+
|------|------|-------------|----------|
84+
| api | string | The API mode that depends on the model used and the scenario selected. *Supported values: (Completion \| Chat)* | Yes |
85+
| endpoint_name | string | Name of an Online Inferencing Endpoint with a supported model deployed on it. Takes priority over connection. | No |
86+
| temperature | float | The randomness of the generated text. Default is 1. | No |
87+
| max_new_tokens | integer | The maximum number of tokens to generate in the completion. Default is 500. | No |
88+
| top_p | float | The probability of using the top choice from the generated tokens. Default is 1. | No |
89+
| 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 |
90+
| 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 are used. | No |
91+
| prompt | string | The text prompt that the language model uses to generate its response. | Yes |
92+
93+
## Outputs
94+
95+
| API | Return Type | Description |
96+
|------------|-------------|------------------------------------------|
97+
| Completion | string | The text of one predicted completion |
98+
| Chat | string | The text of one response int the conversation |
99+
100+
## Deploying to an online endpoint
101+
102+
When you deploy a flow containing the Open Model LLM tool to an online endpoint, there's an extra step to set up permissions. During deployment through the web pages, there's a choice between System-assigned and User-assigned Identity types. Either way, using the Azure portal (or a similar functionality), add the "Reader" Job function role to the identity on the Azure Machine Learning workspace or Ai Studio project, which is hosting the endpoint. The prompt flow deployment may need to be refreshed.

articles/machine-learning/prompt-flow/tools-reference/open-source-llm-tool.md

Lines changed: 0 additions & 78 deletions
This file was deleted.

articles/machine-learning/prompt-flow/tools-reference/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The following table provides an index of tools in prompt flow. If existing tools
2424
| [LLM](./llm-tool.md) | Uses Open AI's large language model (LLM) for text completion or chat. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
2525
| [Prompt](./prompt-tool.md) | Crafts a prompt by using Jinja as the templating language. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
2626
| [Embedding](./embedding-tool.md) | Uses Open AI's embedding model to create an embedding vector that represents the input text. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
27-
| [Open Source LLM](./open-source-llm-tool.md) | Uses an open-source model from the Azure Model catalog, deployed to an Azure Machine Learning online endpoint for large language model Chat or Completion API calls. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
27+
| [Open Model LLM](./open-model-llm-tool.md) | Uses an open-source model from the Azure Model catalog, deployed to an Azure Machine Learning online endpoint for large language model Chat or Completion API calls. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
2828
| [Serp API](./serp-api-tool.md) | Uses Serp API to obtain search results from a specific search engine. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
2929
| [Content Safety (Text)](./content-safety-text-tool.md) | Uses Azure Content Safety to detect harmful content. | Default | [promptflow-tools](https://pypi.org/project/promptflow-tools/) |
3030
| [Faiss Index Lookup](./faiss-index-lookup-tool.md) | Searches a vector-based query from the Faiss index file. | Default | [promptflow-vectordb](https://pypi.org/project/promptflow-vectordb/) |

articles/machine-learning/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@
696696
href: ./prompt-flow/tools-reference/vector-db-lookup-tool.md
697697
- name: SERP API tool
698698
href: ./prompt-flow/tools-reference/serp-api-tool.md
699-
- name: Open Source LLM tool
700-
href: ./prompt-flow/tools-reference/open-source-llm-tool.md
699+
- name: Open Model LLM tool
700+
href: ./prompt-flow/tools-reference/open-model-llm-tool.md
701701
- name: OpenAI GPT-4V tool
702702
href: ./prompt-flow/tools-reference/openai-gpt-4v-tool.md
703703
- name: Troubleshoot Guidance

0 commit comments

Comments
 (0)