GoodLuckChuck commited on
Commit
766b9e2
·
verified ·
1 Parent(s): ab8d5ab

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -64
README.md CHANGED
@@ -9,67 +9,3 @@ sdk_version: 4.29.0
9
  hf_oauth: true
10
  app_file: ap.py
11
  ---
12
-
13
- # Chuck Agent - Evaluation Runner
14
-
15
- This application implements an AI agent using the `smolagents` framework. The agent is designed to answer questions by leveraging a suite of tools for various tasks. This Gradio interface allows users to run an evaluation against a set of questions fetched from a Hugging Face hosted API and submit the agent's answers for scoring.
16
-
17
- ## Core Agent Capabilities
18
-
19
- The agent can:
20
- * **Retrieve information from the web:** Utilizes the Serper API for real-time web searches.
21
- * **Perform calculations:** Evaluates mathematical expressions.
22
- * **Process and analyze images:** Retrieves images from URLs and stores them (currently in memory).
23
-
24
- ## How it Works
25
-
26
- 1. **Authentication:** Users log in with their Hugging Face account.
27
- 2. **Question Fetching:** The application fetches a list of questions from the [Unit 4 Scoring API](https://huggingface.co/spaces/agents-course/unit4_scoring_api).
28
- 3. **Agent Processing:** For each question:
29
- * The `QuestionAnsweringAgent` (a `smolagents.CodeAgent`) plans and executes steps.
30
- * It uses its tools (`WebSearchTool`, `CalculatorTool`, `ImageRetrievalTool`) as needed.
31
- * It formulates a final answer based on its reasoning and tool outputs.
32
- * The default LLM for the agent is `gpt-3.5-turbo` (configurable to `gpt-4`).
33
- 4. **Submission & Scoring:** The agent's answers are submitted back to the scoring API, and the results, including an overall score, are displayed.
34
-
35
- ## Requirements for Running
36
-
37
- To successfully run the evaluation, you'll need:
38
- * An **OpenAI API key**: For the underlying language model (e.g., GPT-3.5 Turbo or GPT-4).
39
- * A **Serper API key**: For the web search functionality.
40
- * A **Hugging Face account**: To log in and submit answers for scoring.
41
-
42
- These API keys must be set as **Secrets** in your Hugging Face Space environment:
43
- * `OPENAI_API_KEY`
44
- * `SERPER_API_KEY`
45
-
46
- ## Tools Used by the Agent
47
-
48
- * **`WebSearchTool`**: Searches the web using the Serper API to find relevant information.
49
- * **`CalculatorTool`**: Performs mathematical calculations based on string expressions.
50
- * **`ImageRetrievalTool`**: Retrieves images from given URLs. Currently stores image data in memory and returns a confirmation message.
51
-
52
- ## Implementation Details
53
-
54
- * **Framework**: `smolagents` for agent and tool creation.
55
- * **Agent Type**: `smolagents.CodeAgent` which allows for multi-step reasoning and tool invocation.
56
- * **LLM Model**: Configured to use `gpt-3.5-turbo` by default for a balance of speed and capability. Can be switched to `gpt-4` in the `AppConfig` section of the script for more complex reasoning, at the cost of speed and potential expense.
57
- * **Asynchronous Operations**: Tools requiring network I/O (web search, image retrieval) are implemented asynchronously using `aiohttp` with a shared client session for efficiency.
58
- * **Error Handling**: Includes error handling for API key checks, network requests, and agent processing steps.
59
- * **User Interface**: Built with Gradio, providing a simple interface to trigger the evaluation and view results.
60
-
61
- ## Usage Instructions
62
-
63
- 1. **Log In:** Click the "Login with Hugging Face" button.
64
- 2. **Run Evaluation:** Once logged in, click the "Run Evaluation & Submit All Answers" button.
65
- * This will fetch questions, have the agent process each one, and then submit all answers.
66
- 3. **View Results:**
67
- * The "Run Status / Submission Result" textbox will display the overall outcome of the submission, including the score.
68
- * The "Questions and Agent Answers" table will show each question, the agent's submitted answer, and the reasoning trace.
69
-
70
- ## Configuration
71
-
72
- Key configurations can be found in the `AppConfig` class within the script (`app.py`):
73
- * `OPENAI_MODEL_ID`: Change between `"gpt-3.5-turbo"` and `"gpt-4"`.
74
- * `SERPER_API_NUM_RESULTS`: Number of search results the `WebSearchTool` aims to process.
75
- * `AGENT_MAX_STEPS`: Maximum number of steps the agent can take to answer a question.
 
9
  hf_oauth: true
10
  app_file: ap.py
11
  ---