ccc112b / ai

課程:人工智慧 -- 筆記、習題與報告
3 stars 53 forks source link

習題10: 請自己設計 RAG 或 ReAct 的程式 (可以用 langchain 或 dspy) #12

Open ccckmit opened 1 month ago

ccckmit commented 1 month ago

參考

  1. 提示工程
  2. https://www.langchain.com/
  3. https://console.groq.com/docs/quickstart
  4. 02b-LLM提示工程
  5. https://github.com/stanfordnlp/dspy
  6. RAG 可參考 -- https://www.perplexity.ai/
  7. ReAct 可參考

ReAct 的一種可能提示詞

sys_prompt = """
You run in a loop of Thought, Action, Observation.
At the end of the loop you output an Answer
Use Thought to describe your thoughts about the question you have been asked.
Use Action to run one of the actions available to you。
Observation will be the result of running those actions.

Your available actions are:

calculate:
e.g. calculate: 4 * 7 / 3
Runs a calculation and returns the number - uses Python so be sure to use floating point syntax if necessary

call_google:
e.g. call_google: European Union
Returns a summary from searching European Union on google

You can look things up on Google if you have the opportunity to do so, or you are not sure about the query

Example1:

Question: What is the capital of Australia?
Thought: I can look up Australia on Google
Action: call_google: Australia

You will be called again with this:

Observation: Australia is a country. The capital is Canberra.

You then output:

Answer: The capital of Australia is Canberra

Example2:

Question: What are the constituent countries of the European Union? Try to list all of them.
Thought: I can search the constituent countries in European Union by Google
Action: call_google: constituent countries in European Union

Observation: The European Union is a group of 27 countries in Europe, Today, 27 countries are part of the European Union.
These countries are:

Austria、Belgium、Bulgaria、Croatia、Cyprus、Czechia、Denmark、Estonia、Finland、France、Germany、Greece、Hungary、Ireland、
Italy、Latvia、Lithuania、Luxembourg、Malta、Netherands、Poland、Portugal、Romania、Slovakia、Slovenia、Spain、Sweden

Answer: There are 27 constituent countries in European Union, the name of constituent countries are listed as follows
Austria
Belgium
Bulgaria
Croatia
Cyprus
Czechia
Denmark
Estonia
Finland
France
Germany
Greece
Hungary
Ireland
Italy
Latvia
Lithuania
Luxembourg
Malta
Netherlands
Poland
Portugal
Romania
Slovakia
Slovenia
Spain
Sweden

""".strip()
LeeYi-user commented 1 month ago

https://github.com/LeeYi-user/ai/blob/master/homework/10/react.py 資工三 李易 111010512

KiuBios commented 1 month ago

資工二 胡劭家 111110519 https://github.com/KiuBios/ai/tree/master/aiSecretary

wrr606 commented 3 weeks ago

資工二 111110517 范揚玄 https://github.com/wrr606/ai/tree/master/homework/10

ctfpanda17 commented 3 weeks ago

電三甲 111010148 林晏霆 https://github.com/ctfpanda17/ai/blob/master/hw10.py

111010557 commented 3 weeks ago

資工三111010557 楊欣潔 https://github.com/111010557/ai/blob/master/hw/10

lkhagvaa2444 commented 2 weeks ago

資工二 111110544 李荷葦 https://github.com/lkhagvaa2444/ai/tree/master/HW10

siyu0927 commented 2 weeks ago

資工三 111010508 葉思妤 https://github.com/siyu0927/ai/blob/master/HW/hw10.py

jackuio440 commented 2 weeks ago

資工三 111010502 劉爵寬 https://github.com/jackuio440/ai/tree/master/HW/10

kingpider123 commented 2 weeks ago

資工三 111010552 阮銘福 https://github.com/kingpider123/ai/tree/master/homework/10

weixiang0470 commented 2 weeks ago

資工三 黃偉祥 111010550 Homework 10

Kruez0 commented 2 weeks ago

資工二劉佩芬111110541 https://github.com/Kruez0/ai/tree/master/h10

ali1234-56 commented 2 weeks ago

資工三 111010536 林家成 hk10

Tzuan1020 commented 2 weeks ago

資工三 111010517 蘇子安 習題十

rossen1020 commented 2 weeks ago

111010516 資工三 賴映羽 10

sam00002135 commented 1 week ago

資工三 111010574 白和鑫 https://github.com/sam00002135/ai/blob/master/home10.py

dallas145 commented 1 week ago

資工三 111010511 蔡松宏 習題十

yihsien924 commented 1 week ago

資工三 林羿嫻 111010555 hw10

ruoxin030704 commented 1 week ago

資工三 111010576 王若馨 https://github.com/ruoxin030704/ai/tree/master/10

Jung217 commented 1 week ago

資工三 簡志融 111010501 習題十

byby9527 commented 1 week ago

111010540 資工三 陳先正 https://github.com/byby9527/ai/tree/master/10

weichen11011 commented 1 week ago

資工三 顏瑋成 111010529 習題10

Chieh0622 commented 1 week ago

資工三 111010515 林弘杰 HW10

a920217 commented 1 week ago

資工三 111010538 陳紹恩 hw10

MitanEXE commented 1 week ago

資工三 111010544 陳彬彬 HW10

Ellinaa commented 1 week ago

資工四 110910558 陳玟卉 習題10

gakuplusq commented 1 week ago

110910530 資工四 黃劭騏

patrick0516 commented 1 week ago

資工三 111010575 周辰恩 hw10

yehchen0328 commented 1 week ago

資工三 111010535 葉哲辰 https://github.com/yehchen0328/ai/blob/master/hw10.py

guangbo1110105228 commented 1 week ago

資工三 111010528 冉光博 https://github.com/guangbo1110105228/ai/blob/master/hw10.py

nelson023 commented 1 week ago

資工四 110910523張繼光 https://github.com/nelson023/ai/blob/master/hw/hw10.py