Comments (1)
Hi @khchan, we don't support sub-flows and the promptflow package is designed to use in user's local machine instead of running in the cloud. load_flow
has an assumption that all flow's connection should exist in user's local machine. But when executes in the cloud, those connections are not stored in the runtime machine. Which lead to the error above.
Here's a work around for your case: make connection a input and directly call built-in tool with that object.
Here's sample code:
from promptflow import load_flow, tool
from promptflow.connections import AzureOpenAIConnection
from jinja2 import Template
from promptflow.tools.aoai import chat
# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding type to arguments and return value will help the system show the types properly
# Please update the function name/signature per need
# In Python tool you can do things like calling external services or
# pre/post processing of data, pretty much anything you want
@tool
def echo(input: str, my_connection: AzureOpenAIConnection) -> str:
# subjoke = load_flow("./subjoke")
# print(subjoke.context)
# print(subjoke.context.connections)
# subjoke_output = subjoke(topic=input, connection=my_connection)
# instead of load sub flow as a flow, directly call tools here
# load prompt
with open("subjoke/joke.jinja2", "r", encoding="utf-8") as f:
tmpl = Template(f.read(), trim_blocks=True, keep_trailing_newline=True)
prompt = tmpl.render(topic=input)
# directly call tool function with connection object
output = chat(
connection=my_connection,
prompt=prompt,
deployment_name="gpt-35-turbo",
max_tokens=256,
temperature=0.7,
)
return output
from promptflow.
Related Issues (20)
- [BUG] Issue in Batch Run Settings HOT 14
- Fix docs cli example to give the promised run details table output HOT 1
- [BUG] EvaluationRun Failed HOT 7
- [BUG] Link broken to prompt template documentation when running LLM node with incorrect prompt template HOT 2
- [Feature Request] Turn down verbosity of flow executor for LLM endpoint retries/backoffs HOT 4
- [Feature Request] Support for using AML datastore uri for Image fields with GPT4V model HOT 2
- [Feature Request] Not able to see logs generated from python node in AML workspace HOT 3
- [BUG] `pip install git+https://github.com/promptflow/src/promptflow` doesn't work starting from today HOT 2
- [BUG] Validate and parse input failed HOT 8
- [Feature Request] Update Python version in the Azure ML runtime HOT 1
- Manual approval required for workflow run 8277804808: Request to upload secret to key vault for e2e test. HOT 2
- Manual approval required for workflow run 8277827138: Request to upload secret to key vault for e2e test. HOT 2
- [Feature Request] Hope to get the token usage report per AOAI connection deployment HOT 4
- [BUG] OpenAI Base URL not Working for Local Model HOT 1
- [BUG] Embedding not a ToolType HOT 3
- [Feature Request] LMQL Integration HOT 4
- [Feature Request] Cannot filter from complete dataset in View output page HOT 1
- [Feature Request] Support to fail custom python tool manually with outputs HOT 1
- [BUG] List variable inputs aren't interpreted for python nodes HOT 1
- Is there a way to have front end app chatting template like Azure Sampleaoai which consumes the endpoint? Need to do it with APP Service. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promptflow.