Skip to content

Commit ab6a04f

Browse files
author
9race22
committed
react version of minions
remove comments
1 parent 43e1718 commit ab6a04f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6690
-10
lines changed

app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,12 +1100,12 @@ def validate_azure_openai_key(api_key):
11001100
default_model_index = 0
11011101
elif selected_provider == "Together":
11021102
model_mapping = {
1103-
"DeepSeek-V3 (Recommended)": "deepseek-ai/DeepSeek-V3",
1104-
"Qwen 2.5 72B (Recommended)": "Qwen/Qwen2.5-72B-Instruct-Turbo",
1105-
"Meta Llama 3.1 405B (Recommended)": "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
1103+
"DeepSeek-V3": "deepseek-ai/DeepSeek-V3",
11061104
"DeepSeek-R1": "deepseek-ai/DeepSeek-R1",
1107-
"Llama 3.3 70B": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
1108-
"QWQ-32B": "Qwen/QwQ-32B-Preview",
1105+
"Qwen2.5-72B": "Qwen/Qwen2.5-72B-Instruct-Turbo",
1106+
"Meta-Llama-3.1-405B": "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
1107+
"Llama-3.3-70B": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
1108+
"QWQ-32B": "Qwen/QwQ-32B-Preview"
11091109
}
11101110
default_model_index = 0
11111111
elif selected_provider == "Perplexity":
@@ -1293,7 +1293,7 @@ def validate_azure_openai_key(api_key):
12931293
else:
12941294
current_content = extract_text_from_image(image_base64) or ""
12951295
else:
1296-
current_content = uploaded_file.getvalue().decode()
1296+
current_content = uploaded_file.getvalue().decode("utf-8")
12971297

12981298
if current_content:
12991299
all_file_contents.append("\n--------------------")

backend/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fastapi==0.109.2
2+
uvicorn==0.27.1
3+
python-dotenv==1.0.1
4+
pydantic==2.6.1
5+
minions @ file:///Users/jsluo/Downloads/minions

gateway_app_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def validate_together_key(api_key):
571571
if file_type == "pdf":
572572
current_content = extract_text_from_pdf(uploaded_file.read()) or ""
573573
else:
574-
current_content = uploaded_file.getvalue().decode()
574+
current_content = uploaded_file.getvalue().decode("utf-8")
575575

576576
if current_content:
577577
all_file_contents.append("\n--------------------")

minion_logs/20250326_105442_hi_summarize.json

Lines changed: 27 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"task": "summarize ",
3+
"context": "The president had floated the idea of also announcing sector-specific tariffs on cars, pharmaceuticals and semiconductors that same day. On Monday, White House officials said that those additional tariffs had not yet been set for April 2 but that the situation remained very fluid.\nOne official said that separate tariffs on cars could still happen on April 2. Another official said that if tariffs on cars and other sectors did not happen on April 2, they could still be imposed at a later date.\nMarkets opened higher on Monday after Bloomberg and The Wall Street Journal reported that the White House was not likely to announce industry-specific tariffs on April 2.\nStill, the price of imported cars, medicines and semiconductors will probably go up through Mr. Trump’s reciprocal tariff plan. Many details of that plan remain unclear, but administration officials have indicated that the reciprocal tariffs would add an additional fee on top of most or all products imported from specific countries.\nIt’s not clear how many countries will be hit, but Trump officials have mentioned the “dirty 15,” a reference to a group of countries that have tariffs on American products and run trade surpluses with the United States, presumably including most of America’s largest trading partners.\n\n\nThe reciprocal tariff plan has created a tricky calculus for many companies, which want to see trade barriers erased but fear ending up at the center of a trade war that could make them worse off. That is because Mr. Trump’s high-stakes approach could generate efforts by other countries to make deals with the United States and drop their own tariffs — or it could invite retaliation that ends up closing off foreign markets to American products. \n\nSome American companies see an opportunity in Mr. Trump’s agenda. Many of the letters that companies submitted to the Office of the United States Trade Representative in recent weeks asked officials to fight for lower trade barriers on their behalf, highlighting the high levies, onerous inspections or other complications American exporters face in foreign markets.\nBut others appear hesitant to put themselves in the president’s cross hairs. Some industry representatives say privately that companies have been nervous that raising their hands for help could put them at the center of coming trade spats, disrupting the export markets they depend on and potentially making them a target for retaliation.\nPublicly, many of America’s biggest exporters — like the trade groups that represent exporters of pork, soybeans and oil — tempered their filings with cautionary words about the harm that could come from disrupting export markets. Major business groups also continued to urge the administration to reduce trade barriers rather than raise them, and focus on striking new trade agreements that would open up foreign markets.",
4+
"conversation": [
5+
{
6+
"user": "remote",
7+
"prompt": "We need to perform the following task.\n\n### Task\nsummarize \n\n### Instructions\nYou will not have direct access to the context, but can chat with a small language model which has read the entire thing.\n\nFeel free to think step-by-step, but eventually you must provide an output in the format below:\n\n```json\n{\n \"message\": \"<your message to the small language model. If you are asking model to do a task, make sure it is a single task!>\"\n}\n```\n",
8+
"output": "{\n \"message\": \"Please summarize the context you have read in a concise and clear manner.\"\n}"
9+
},
10+
{
11+
"user": "local",
12+
"prompt": "Please summarize the context you have read in a concise and clear manner.",
13+
"output": "Here's a summary of the context:\n\nThe US President has floated the idea of announcing sector-specific tariffs (tariffs on cars, pharmaceuticals, and semiconductors) on April 2. However, White House officials have clarified that these additional tariffs are not yet set for April 2, but the situation remains fluid. The proposed reciprocal tariff plan would add an extra fee to imported products from specific countries, including \"the dirty 15\" (countries with tariffs on American products and trade surpluses). This has created uncertainty among companies, which want to see trade barriers reduced but fear being caught in a trade war that could harm their business."
14+
},
15+
{
16+
"user": "remote",
17+
"prompt": "\nHere is the response from the small language model:\n\n### Response\nHere's a summary of the context:\n\nThe US President has floated the idea of announcing sector-specific tariffs (tariffs on cars, pharmaceuticals, and semiconductors) on April 2. However, White House officials have clarified that these additional tariffs are not yet set for April 2, but the situation remains fluid. The proposed reciprocal tariff plan would add an extra fee to imported products from specific countries, including \"the dirty 15\" (countries with tariffs on American products and trade surpluses). This has created uncertainty among companies, which want to see trade barriers reduced but fear being caught in a trade war that could harm their business.\n\n\n### Instructions\nAnalyze the response and think-step-by-step to determine if you have enough information to answer the question.\n\nThink about:\n1. What information we have gathered\n2. Whether it is sufficient to answer the question\n3. If not sufficient, what specific information is missing\n4. If sufficient, how we would calculate or derive the answer\n\n",
18+
"output": "Let's analyze step by step:\n\n1. **Information gathered**: \n - The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors). \n - Announcement timing is uncertain (April 2 floated but not confirmed). \n - The plan involves reciprocal tariffs on \"the dirty 15\" countries. \n - Businesses are concerned about trade barriers and potential trade wars. \n\n2. **Sufficiency for summarization**: \n - The response provides a clear, high-level summary of the context, covering key points (tariff proposal, uncertainty, business concerns). \n\n3. **Missing information (if any)**: \n - Not applicable, as the task was to summarize, and the model provided a coherent summary. \n\n4. **Conclusion**: \n - The response is sufficient. No further action is needed unless additional details (e.g., specific tariff rates, country lists) are required. \n\nFinal output (no further query needed): \n```json\n{\n \"summary\": \"The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors), potentially announced around April 2, though timing is uncertain. The reciprocal tariff plan targets 'the dirty 15' countries, raising concerns among businesses about trade barriers and potential trade wars.\"\n}\n```"
19+
},
20+
{
21+
"user": "remote",
22+
"prompt": "Here is the response after step-by-step thinking.\n\n### Response\nLet's analyze step by step:\n\n1. **Information gathered**: \n - The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors). \n - Announcement timing is uncertain (April 2 floated but not confirmed). \n - The plan involves reciprocal tariffs on \"the dirty 15\" countries. \n - Businesses are concerned about trade barriers and potential trade wars. \n\n2. **Sufficiency for summarization**: \n - The response provides a clear, high-level summary of the context, covering key points (tariff proposal, uncertainty, business concerns). \n\n3. **Missing information (if any)**: \n - Not applicable, as the task was to summarize, and the model provided a coherent summary. \n\n4. **Conclusion**: \n - The response is sufficient. No further action is needed unless additional details (e.g., specific tariff rates, country lists) are required. \n\nFinal output (no further query needed): \n```json\n{\n \"summary\": \"The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors), potentially announced around April 2, though timing is uncertain. The reciprocal tariff plan targets 'the dirty 15' countries, raising concerns among businesses about trade barriers and potential trade wars.\"\n}\n```\n\n### Instructions\nIf you have enough information or if the task is complete, write a final answer to fullfills the task. \n\n```json\n{\n \"decision\": \"provide_final_answer\", \n \"answer\": \"<your answer>\"\n}\n```\n\nOtherwise, if the task is not complete, request the small language model to do additional work, by outputting the following:\n\n```json\n{\n \"decision\": \"request_additional_info\",\n \"message\": \"<your message to the small language model>\"\n}\n```\n\n",
23+
"output": "{\n \"decision\": \"provide_final_answer\",\n \"answer\": \"The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors), potentially announced around April 2, though timing is uncertain. The reciprocal tariff plan targets 'the dirty 15' countries, raising concerns among businesses about trade barriers and potential trade wars.\"\n}"
24+
}
25+
],
26+
"generated_final_answer": "The US is considering sector-specific tariffs (cars, pharmaceuticals, semiconductors), potentially announced around April 2, though timing is uncertain. The reciprocal tariff plan targets 'the dirty 15' countries, raising concerns among businesses about trade barriers and potential trade wars."
27+
}

minions-application/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

minions-application/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13+
14+
```js
15+
export default tseslint.config({
16+
extends: [
17+
// Remove ...tseslint.configs.recommended and replace with this
18+
...tseslint.configs.recommendedTypeChecked,
19+
// Alternatively, use this for stricter rules
20+
...tseslint.configs.strictTypeChecked,
21+
// Optionally, add this for stylistic rules
22+
...tseslint.configs.stylisticTypeChecked,
23+
],
24+
languageOptions: {
25+
// other options...
26+
parserOptions: {
27+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
28+
tsconfigRootDir: import.meta.dirname,
29+
},
30+
},
31+
})
32+
```
33+
34+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35+
36+
```js
37+
// eslint.config.js
38+
import reactX from 'eslint-plugin-react-x'
39+
import reactDom from 'eslint-plugin-react-dom'
40+
41+
export default tseslint.config({
42+
plugins: {
43+
// Add the react-x and react-dom plugins
44+
'react-x': reactX,
45+
'react-dom': reactDom,
46+
},
47+
rules: {
48+
// other rules...
49+
// Enable its recommended typescript rules
50+
...reactX.configs['recommended-typescript'].rules,
51+
...reactDom.configs.recommended.rules,
52+
},
53+
})
54+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config(
8+
{ ignores: ['dist'] },
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser,
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh,
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': [
23+
'warn',
24+
{ allowConstantExport: true },
25+
],
26+
},
27+
},
28+
)

minions-application/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)