thrag commited on
Commit
056bbbf
1 Parent(s): b96faa7

requirements

Browse files
Files changed (3) hide show
  1. demo-tools-1.ipynb +56 -0
  2. housekeeping.ipynb +9 -0
  3. requirements.txt +0 -0
demo-tools-1.ipynb CHANGED
@@ -464,6 +464,62 @@
464
  "#gr.Examples(\"text\", \"text\")\n",
465
  "demo.launch(show_error=True)"
466
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
468
  ],
469
  "metadata": {
 
464
  "#gr.Examples(\"text\", \"text\")\n",
465
  "demo.launch(show_error=True)"
466
  ]
467
+ },
468
+ {
469
+ "cell_type": "code",
470
+ "execution_count": 240,
471
+ "metadata": {},
472
+ "outputs": [],
473
+ "source": [
474
+ "# import gradio as gr\n",
475
+ "\n",
476
+ "# def ask_question(question):\n",
477
+ " \n",
478
+ "# # LLM \n",
479
+ "# llm = ChatOpenAI(temperature=0, model_name='gpt-4') # 'gpt-3.5-turbo'\n",
480
+ "# agent = initialize_agent(agent=\"zero-shot-react-description\", tools=tools, llm=llm, verbose=True, max_iterations=7, return_intermediate_steps=True)\n",
481
+ "# system = \"If the answer is not in the tools or context passed to you then don't answer. \\nIf you don't know the answer then say so.\" \n",
482
+ "# # #question = \"Can you show tell me what ingredients I need for the first baked chicken recipe?\"\n",
483
+ "# # #question = \"Can you show tell me what ingredients I need for the last baked chicken recipe? \"\n",
484
+ "# # #question = \"What is the best baked chicken recipe? Please look across all recipes with the word 'baked' in the title\" # There are 3 baked chicken recipes\n",
485
+ "# # #question = \"Is there a Chicken recipe that's prepared with an alchohol? And if so how long does it take in total from start time to finish?\"\n",
486
+ "# # #question = \"Which is healthier the Caramel Apple Pie Cookies or the beer chicken? Please explain how you got to your answer.\"\n",
487
+ "# # #question = \"Is the moon closer to earth or the sun?\"\n",
488
+ "# # #question = \"How good are the apple pie cookies?\"\n",
489
+ "# # #question = \"What tools do I need for the Nutella Ice Cream?\"\n",
490
+ "# # #question = \"My bowl is broken, can I still make Nutella Ice Cream? Answer as a yes/no.\"\n",
491
+ "# response = agent({\"input\": f\"{system} {question}\"})\n",
492
+ "\n",
493
+ "# # Show response \n",
494
+ "# stepsDict = json.loads(dumps(response[\"intermediate_steps\"], pretty=True))\n",
495
+ "# resp = 'Below are the steps the agent took to get to the Final Answer. \\n\"Thought\" is the LLMs internal dialogue, \\n\"Action\" is the tool it will use to fetch the next piece of information. \\n\"Action Input\" is the input it passes the tool to fetch this information. \\n\"Action Response\" is what was returned from the tool to the LLM at that given step. '\n",
496
+ "# resp += '\\n\\n'\n",
497
+ "# resp += 'Steps to solve answer using ReAct\\n'\n",
498
+ "# for i in range(len(stepsDict)):\n",
499
+ "# resp += '##########################################\\n'\n",
500
+ "# resp += f'Step: {i+1} of {len(stepsDict)}\\n'\n",
501
+ "# resp += f\"Thought: {stepsDict[i][0]['kwargs']['log']}\\n\"\n",
502
+ "# resp += 'Below is what the tool returned...\\n'\n",
503
+ "# resp += f\"Action response: {stepsDict[i][1]}\\n\" \n",
504
+ "# resp += '\\n'\n",
505
+ "\n",
506
+ "# resp += '\\nFinal Thought:\\n'\n",
507
+ "# resp += response['output']\n",
508
+ "# return resp\n",
509
+ "\n",
510
+ "# with gr.Blocks() as demo:\n",
511
+ "# openAIKeyBox = gr.Text(label=\"OpenAI Key\")\n",
512
+ "# queryTB = gr.Textbox(label=\"Query\")\n",
513
+ "# submitBtn = gr.Button(\"Submit\")\n",
514
+ "# submitBtn.click(\n",
515
+ "# ask_question\n",
516
+ "# )\n",
517
+ "\n",
518
+ "# # demo = gr.Interface(fn=ask_query, inputs=\"text\", outputs=\"text\", allow_flagging=False)\n",
519
+ "# # #gr.Markdown(\"# Hello there\")\n",
520
+ "# # #gr.Examples(\"text\", \"text\")\n",
521
+ "# # demo.launch(show_error=True)"
522
+ ]
523
  }
524
  ],
525
  "metadata": {
housekeeping.ipynb CHANGED
@@ -1,5 +1,14 @@
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 3,
 
1
  {
2
  "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "# pip freeze > requirements.txt"
10
+ ]
11
+ },
12
  {
13
  "cell_type": "code",
14
  "execution_count": 3,
requirements.txt ADDED
Binary file (4.54 kB). View file