Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Converter Docs and Demos #100

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions doc/code/aml_endpoints.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "7fe2e8a9",
"id": "b522ac89",
"metadata": {
"lines_to_next_cell": 0
},
Expand Down Expand Up @@ -34,21 +34,21 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "9dfdb29c",
"id": "13743ee2",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:37:57.987744Z",
"iopub.status.busy": "2024-03-07T19:37:57.987744Z",
"iopub.status.idle": "2024-03-07T19:38:26.669303Z",
"shell.execute_reply": "2024-03-07T19:38:26.669178Z"
"iopub.execute_input": "2024-03-13T20:56:27.166931Z",
"iopub.status.busy": "2024-03-13T20:56:27.165931Z",
"iopub.status.idle": "2024-03-13T20:56:50.989279Z",
"shell.execute_reply": "2024-03-13T20:56:50.988278Z"
},
"lines_to_next_cell": 2
},
"outputs": [
{
"data": {
"text/plain": [
"\"Hello! I'm here to help you with any questions you have about art, design, or creative projects. Do you have something you'd like to work on or discuss? I'd be happy to help!\\n\\nIn the meantime, here are a few tips for getting started on a new art or design project:\\n\\n1. Define your goals: What do you want to achieve with your project? Do you want to create a finished piece of art, or are you looking to explore a particular technique or concept? Having clear goals in mind will help you stay focused and motivated as you work.\\n2. Gather inspiration: Look for examples of work that inspire you and take note of what you like about them. This can help you clarify your own goals and give you ideas for how to approach your project.\\n3. Create a plan: Outline the steps you'll need to take to complete your project. This can help you stay organized and ensure that you don't forget any important details.\\n4. Experiment and play: Don't be afraid to try new techniques or materials, and allow yourself the freedom to make mistakes. The creative process is often messy and unpredictable, but it's also an opportunity to learn and grow as an artist.\\n5. Seek feedback: Share your work with others and be open to constructive criticism. This can help you see your work from new perspectives and give you ideas for how to improve.\\n\\nI hope these tips are helpful as you begin your project! Let me know if you have any questions or if there's anything else I can do to support you.\""
"\"Hello! I'm here to help you with any questions you have about marketing, branding, or design. Is there something specific you'd like to know or discuss? I'm here to assist you in any way I can.\\n\\nMarketing is the process of identifying, anticipating, and satisfying customer needs and wants through the creation, promotion, and distribution of products and services. It involves a wide range of activities, including market research, advertising, public relations, and sales.\\n\\nEffective marketing requires a deep understanding of your target audience, as well as the ability to effectively communicate the value of your product or service to them. It's also important to have a strong brand, which is the overall perception and reputation of your company or organization. A strong brand can help you stand out in a crowded market and build trust and loyalty with your customers.\\n\\nDesign plays a critical role in marketing, as it helps to create visual appeal and communicate the key messages and value of your product or service. Good design can help to grab attention, convey complex information in a simple and engaging way, and create a positive and memorable impression.\\n\\nI hope this information is helpful. Let me know if you have any specific questions or if there's anything else I can do for you. I'm here to help!\""
]
},
"execution_count": 1,
Expand All @@ -72,7 +72,7 @@
},
{
"cell_type": "markdown",
"id": "3eddb829",
"id": "831b50be",
"metadata": {},
"source": [
"\n",
Expand All @@ -82,13 +82,13 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "326e2adb",
"id": "57eb9828",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:26.674019Z",
"iopub.status.busy": "2024-03-07T19:38:26.673012Z",
"iopub.status.idle": "2024-03-07T19:38:27.470128Z",
"shell.execute_reply": "2024-03-07T19:38:27.468876Z"
"iopub.execute_input": "2024-03-13T20:56:50.993795Z",
"iopub.status.busy": "2024-03-13T20:56:50.992857Z",
"iopub.status.idle": "2024-03-13T20:56:51.875944Z",
"shell.execute_reply": "2024-03-13T20:56:51.874941Z"
}
},
"outputs": [],
Expand Down
26 changes: 13 additions & 13 deletions doc/code/azure_completions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "89bae068",
"id": "20e45e3b",
"metadata": {},
"source": [
"## Introduction\n",
Expand All @@ -22,13 +22,13 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "57fe92b4",
"id": "44970428",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:32.178074Z",
"iopub.status.busy": "2024-03-07T19:38:32.178074Z",
"iopub.status.idle": "2024-03-07T19:38:32.203814Z",
"shell.execute_reply": "2024-03-07T19:38:32.203814Z"
"iopub.execute_input": "2024-03-13T20:56:54.109953Z",
"iopub.status.busy": "2024-03-13T20:56:54.108953Z",
"iopub.status.idle": "2024-03-13T20:56:54.135969Z",
"shell.execute_reply": "2024-03-13T20:56:54.135338Z"
}
},
"outputs": [],
Expand All @@ -45,7 +45,7 @@
},
{
"cell_type": "markdown",
"id": "6b4b4aac",
"id": "c8daf23a",
"metadata": {},
"source": [
"## Azure OpenAI Completions\n",
Expand All @@ -58,21 +58,21 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "781baae0",
"id": "b7d424ca",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:32.207668Z",
"iopub.status.busy": "2024-03-07T19:38:32.207668Z",
"iopub.status.idle": "2024-03-07T19:38:33.747647Z",
"shell.execute_reply": "2024-03-07T19:38:33.746642Z"
"iopub.execute_input": "2024-03-13T20:56:54.139967Z",
"iopub.status.busy": "2024-03-13T20:56:54.138966Z",
"iopub.status.idle": "2024-03-13T20:56:55.726506Z",
"shell.execute_reply": "2024-03-13T20:56:55.725504Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PromptResponse(completion=\" and ... - Geoff's Blog :: Interesting things from around the net... is the\", prompt='hello world!', id='cmpl-90DrVhexmTUx3tQEir5NzFFECXL3I', completion_tokens=16, prompt_tokens=3, total_tokens=19, model='davinci-002', object='text_completion', created_at=0, logprobs=False, index=0, finish_reason='', api_request_time_to_complete_ns=0, metadata={})\n"
"PromptResponse(completion=' - 2 years ago\\n\\nChad Smith is Playing with Lang Lang on CC', prompt='hello world!', id='cmpl-92Pwdpxd50GIyRLzjbQ3GWmMlLZ5T', completion_tokens=16, prompt_tokens=3, total_tokens=19, model='davinci-002', object='text_completion', created_at=0, logprobs=False, index=0, finish_reason='', api_request_time_to_complete_ns=0, metadata={})\n"
]
}
],
Expand Down
50 changes: 25 additions & 25 deletions doc/code/azure_embeddings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "5dd1cca7",
"id": "acff1cca",
"metadata": {},
"source": [
"## Azure OpenAI Embeddings\n",
Expand All @@ -13,13 +13,13 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "7b3f1bb7",
"id": "ff196f44",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:37.718933Z",
"iopub.status.busy": "2024-03-07T19:38:37.718933Z",
"iopub.status.idle": "2024-03-07T19:38:39.164054Z",
"shell.execute_reply": "2024-03-07T19:38:39.163049Z"
"iopub.execute_input": "2024-03-13T20:56:57.419995Z",
"iopub.status.busy": "2024-03-13T20:56:57.418996Z",
"iopub.status.idle": "2024-03-13T20:56:58.753766Z",
"shell.execute_reply": "2024-03-13T20:56:58.752758Z"
}
},
"outputs": [
Expand Down Expand Up @@ -50,7 +50,7 @@
},
{
"cell_type": "markdown",
"id": "09b5e11d",
"id": "df38c342",
"metadata": {},
"source": [
"\n",
Expand All @@ -62,7 +62,7 @@
},
{
"cell_type": "markdown",
"id": "29f35a81",
"id": "c31ff5e7",
"metadata": {},
"source": [
"To view the json of an embedding"
Expand All @@ -71,13 +71,13 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "7bbea889",
"id": "0d94dfcf",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:39.166053Z",
"iopub.status.busy": "2024-03-07T19:38:39.166053Z",
"iopub.status.idle": "2024-03-07T19:38:39.179311Z",
"shell.execute_reply": "2024-03-07T19:38:39.178318Z"
"iopub.execute_input": "2024-03-13T20:56:58.756770Z",
"iopub.status.busy": "2024-03-13T20:56:58.756770Z",
"iopub.status.idle": "2024-03-13T20:56:58.769835Z",
"shell.execute_reply": "2024-03-13T20:56:58.768839Z"
}
},
"outputs": [
Expand All @@ -98,7 +98,7 @@
},
{
"cell_type": "markdown",
"id": "f30708f6",
"id": "fb851c64",
"metadata": {},
"source": [
"To save an embedding to disk"
Expand All @@ -107,13 +107,13 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "88ff3169",
"id": "bf05c574",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:39.180310Z",
"iopub.status.busy": "2024-03-07T19:38:39.180310Z",
"iopub.status.idle": "2024-03-07T19:38:39.196388Z",
"shell.execute_reply": "2024-03-07T19:38:39.196388Z"
"iopub.execute_input": "2024-03-13T20:56:58.773338Z",
"iopub.status.busy": "2024-03-13T20:56:58.773338Z",
"iopub.status.idle": "2024-03-13T20:56:58.784995Z",
"shell.execute_reply": "2024-03-13T20:56:58.783993Z"
}
},
"outputs": [
Expand All @@ -137,7 +137,7 @@
},
{
"cell_type": "markdown",
"id": "17acc78f",
"id": "27844ce7",
"metadata": {
"lines_to_next_cell": 2
},
Expand All @@ -148,13 +148,13 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "02cb2fa4",
"id": "9898d76f",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:39.197393Z",
"iopub.status.busy": "2024-03-07T19:38:39.197393Z",
"iopub.status.idle": "2024-03-07T19:38:39.212610Z",
"shell.execute_reply": "2024-03-07T19:38:39.212610Z"
"iopub.execute_input": "2024-03-13T20:56:58.787994Z",
"iopub.status.busy": "2024-03-13T20:56:58.786994Z",
"iopub.status.idle": "2024-03-13T20:56:58.801022Z",
"shell.execute_reply": "2024-03-13T20:56:58.800024Z"
}
},
"outputs": [
Expand Down
14 changes: 7 additions & 7 deletions doc/code/azure_openai_chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "b4f94849",
"id": "d9482bdb",
"metadata": {},
"source": [
"\n",
Expand All @@ -18,13 +18,13 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "4dce2263",
"id": "6fba39de",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-07T19:38:43.107748Z",
"iopub.status.busy": "2024-03-07T19:38:43.107748Z",
"iopub.status.idle": "2024-03-07T19:38:50.177544Z",
"shell.execute_reply": "2024-03-07T19:38:50.177037Z"
"iopub.execute_input": "2024-03-13T20:57:00.471945Z",
"iopub.status.busy": "2024-03-13T20:57:00.471945Z",
"iopub.status.idle": "2024-03-13T20:57:06.126191Z",
"shell.execute_reply": "2024-03-13T20:57:06.125190Z"
}
},
"outputs": [
Expand Down Expand Up @@ -56,7 +56,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "819ee7c0",
"id": "473fe6e7",
"metadata": {},
"outputs": [],
"source": []
Expand Down
34 changes: 18 additions & 16 deletions doc/code/chat_message.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "dc24e7b3",
"id": "852bc4d3",
"metadata": {
"lines_to_next_cell": 0
},
Expand All @@ -23,13 +23,13 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "ffd01d9a",
"id": "c5f26dde",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-11T23:50:37.970435Z",
"iopub.status.busy": "2024-03-11T23:50:37.970435Z",
"iopub.status.idle": "2024-03-11T23:50:38.166411Z",
"shell.execute_reply": "2024-03-11T23:50:38.166411Z"
"iopub.execute_input": "2024-03-13T20:57:08.262632Z",
"iopub.status.busy": "2024-03-13T20:57:08.262632Z",
"iopub.status.idle": "2024-03-13T20:57:08.476940Z",
"shell.execute_reply": "2024-03-13T20:57:08.475939Z"
}
},
"outputs": [
Expand All @@ -52,9 +52,11 @@
"from pyrit.models import ChatMessage\n",
"from pyrit.chat_message_normalizer import ChatMessageNormalizerChatML\n",
"\n",
"messages = [ChatMessage(role=\"system\", content=\"You are a helpful AI assistant\"),\n",
" ChatMessage(role=\"user\", content=\"Hello, how are you?\"),\n",
" ChatMessage(role=\"assistant\", content=\"I'm doing well, thanks for asking.\")]\n",
"messages = [\n",
" ChatMessage(role=\"system\", content=\"You are a helpful AI assistant\"),\n",
" ChatMessage(role=\"user\", content=\"Hello, how are you?\"),\n",
" ChatMessage(role=\"assistant\", content=\"I'm doing well, thanks for asking.\"),\n",
"]\n",
"\n",
"normalizer = ChatMessageNormalizerChatML()\n",
"chatml_messages = normalizer.normalize(messages)\n",
Expand All @@ -65,7 +67,7 @@
},
{
"cell_type": "markdown",
"id": "a2b874e0",
"id": "57c8680d",
"metadata": {},
"source": [
"\n",
Expand All @@ -75,13 +77,13 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "8cd3e71d",
"id": "ccb01214",
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-11T23:50:38.170354Z",
"iopub.status.busy": "2024-03-11T23:50:38.170354Z",
"iopub.status.idle": "2024-03-11T23:50:38.182462Z",
"shell.execute_reply": "2024-03-11T23:50:38.182462Z"
"iopub.execute_input": "2024-03-13T20:57:08.479941Z",
"iopub.status.busy": "2024-03-13T20:57:08.479941Z",
"iopub.status.idle": "2024-03-13T20:57:08.492609Z",
"shell.execute_reply": "2024-03-13T20:57:08.491609Z"
}
},
"outputs": [
Expand Down Expand Up @@ -110,7 +112,7 @@
},
{
"cell_type": "markdown",
"id": "9adf9e1d",
"id": "2fbeb284",
"metadata": {},
"source": [
"To see how to use this in action, check out the [aml endpoint](./aml_endpoints.ipynb) notebook. It takes a `chat_message_normalizer` parameter so that an AML model can support various chat message formats."
Expand Down
Loading
Loading