Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchao1230 committed May 14, 2024
1 parent e2aca77 commit 7b1e954
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions examples/flex-flows/chat-with-functions/flow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os

from dotenv import load_dotenv
Expand All @@ -9,8 +10,6 @@

BASE_DIR = Path(__file__).absolute().parent

import json


class WeatherInfo(TypedDict):
location: str
Expand Down
20 changes: 10 additions & 10 deletions examples/prompty/format-output/prompty-output-format.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
"metadata": {},
"outputs": [],
"source": [
"from promptflow.core import Flow\n",
"from promptflow.core import Prompty\n",
"\n",
"# load prompty as a flow\n",
"f = Flow.load(\"text_format.prompty\")\n",
"f = Prompty.load(\"text_format.prompty\")\n",
"# execute the flow as function\n",
"question = \"What is the capital of France?\"\n",
"result = f(first_name=\"John\", last_name=\"Doe\", question=question)\n",
Expand Down Expand Up @@ -151,10 +151,10 @@
"metadata": {},
"outputs": [],
"source": [
"from promptflow.core import Flow\n",
"from promptflow.core import Prompty\n",
"\n",
"# load prompty as a flow\n",
"f = Flow.load(\"json_format.prompty\")\n",
"f = Prompty.load(\"json_format.prompty\")\n",
"# execute the flow as function\n",
"question = \"What is the capital of France?\"\n",
"result = f(first_name=\"John\", last_name=\"Doe\", question=question)\n",
Expand Down Expand Up @@ -188,16 +188,16 @@
"metadata": {},
"outputs": [],
"source": [
"from promptflow.core import Flow\n",
"from promptflow.core import Prompty\n",
"\n",
"# load prompty as a flow\n",
"f = Flow.load(\"all_response.prompty\")\n",
"f = Prompty.load(\"all_response.prompty\")\n",
"# execute the flow as function\n",
"question = \"What is the capital of France?\"\n",
"result = f(first_name=\"John\", last_name=\"Doe\", question=question)\n",
"\n",
"# note: the result is a ChatCompletion object\n",
"result"
"print(result.choices[0])"
]
},
{
Expand Down Expand Up @@ -230,10 +230,10 @@
"metadata": {},
"outputs": [],
"source": [
"from promptflow.core import Flow\n",
"from promptflow.core import Prompty\n",
"\n",
"# load prompty as a flow\n",
"f = Flow.load(\"stream_output.prompty\")\n",
"f = Prompty.load(\"stream_output.prompty\")\n",
"# execute the flow as function\n",
"question = \"What's the steps to get rich?\"\n",
"result = f(question=question)\n",
Expand Down Expand Up @@ -352,7 +352,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
"version": "3.9.18"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 7b1e954

Please sign in to comment.