Chapter 42
2.高级RAG管道 Advanced RAG Pipeline
第二章 高级的RAG管道
接下来,导入该课程需要的工具包utils,然后设置openai的API密钥。 有三种方式设置API密钥:
- 在环境变量中设置
OPENAI_API_KEY,然后使用utils直接获取; - 显式设置api_key,直接赋值给openai.api_key;
- 如果没有openai的密钥的话,也可以选择使用第三方服务,修改openai.api_base即可;
import utils
# 导入自定义的工具包
import os
import openai
# openai.api_key = utils.get_openai_api_key()
# 设置OpenAI的API密钥,从环境变量中获取
# openai.api_key = ""
# 或者这里填入你的OpenAI API密钥
# openai.api_key = "sk- "
# openai.api_base = " "
# 或者自定义API密钥和API基础地址,可适用第三方API服务Output
✅ In Answer Relevance, input prompt will be set to __record__.main_input or `Select.RecordInput` . ✅ In Answer Relevance, input response will be set to __record__.main_output or `Select.RecordOutput` . ✅ In Context Relevance, input prompt will be set to __record__.main_input or `Select.RecordInput` . ✅ In Context Relevance, input response will be set to __record__.app.query.rets.source_nodes[:].node.text . ✅ In Groundedness, input source will be set to __record__.app.query.rets.source_nodes[:].node.text . ✅ In Groundedness, input statement will be set to __record__.main_output or `Select.RecordOutput` .
载入文本数据
from llama_index import SimpleDirectoryReader
documents = SimpleDirectoryReader(
input_files=["data/人工智能.pdf"]
).load_data()print(type(documents), "\n")
print(len(documents), "\n")
print(type(documents[0]))
print(documents[0])Output
<class 'list'> 7 <class 'llama_index.schema.Document'> Doc ID: c449baf2-03a3-4f83-a713-f888f7afd7a7 Text: 2/2/24, 2:43 PM ⼈⼯智能 - 维基百科,⾃由的百科全书 https://zh.wikipedia.org/wiki/ ⼈⼯智能 2/13“⼈⼯智能”的各地常⽤名称 中国⼤陆⼈⼯智能 台湾⼈⼯智慧 港澳⼈⼯智能 新⻢⼈⼯智能、⼈⼯智慧 ⽇韩⼈⼯知能 越南智慧⼈造 [展开] [展开] [展开] [展开] [展开] [展开]⼈⼯智能系列内容 主要⽬标 实现⽅式 ⼈⼯智能哲学 历史 技术 术语⼈⼯智能(英语:artificial intelligence ,缩写为 AI)亦称机器智能,指由⼈制造出来的机器所表现出来的智能。通常⼈⼯ 智能是指⽤普通计算机程序来呈现⼈类智能的技术。该词也指出研究这样的智能系统是否能够实现,以及如何实现。同 时,通过 医学 、神经科学 、机器⼈学 及...
from llama_index import SimpleDirectoryReader
documents_en = SimpleDirectoryReader(
input_files=["data/eBook-How-to-Build-a-Career-in-AI.pdf"]
).load_data()print(type(documents_en), "\n")
print(len(documents_en), "\n")
print(type(documents_en[0]))
print(documents_en[0])Output
<class 'list'> 41 <class 'llama_index.schema.Document'> Doc ID: cd516cc9-b646-4394-ab4e-0465c9090af8 Text: PAGE 1Founder, DeepLearning.AICollected Insights from Andrew Ng How to Build Your Career in AIA Simple Guide
一、基础RAG通道
这里通过将 documents 中各个文档的文本连接成一个字符串,然后创建了一个 Document 实例,该实例代表了整个文档集合。
from llama_index import Document
# 将documents中的内容合并成一个大文档,而不是每一页都是一个文档
document = Document(text="\n\n".join([doc.text for doc in documents]))
document_en = Document(text="\n\n".join([doc.text for doc in documents_en]))# 将中文标点符号替换成英文标点符号,方便后续处理
# 如果是英文文档,可以跳过这一步
# 不处理的话,会导致无法正确切分中文句子,会影响后续sentence_window的大小,导致输入长度大于gpt-3.5-turbo的最大限制
document.text=document.text.replace('。','. ')
document.text=document.text.replace('!','! ')
document.text=document.text.replace('?','? ')llm-使用 OpenAI 类创建了一个 GPT-3.5-turbo 模型的实例,并设置了温度参数为 0.1。
service_context-使用 ServiceContext 类创建了一个服务上下文实例,包含了前面创建的 GPT-3.5-turbo 模型以及指定的嵌入模型。
index-使用 VectorStoreIndex.from_documents 方法,基于之前创建的文档和服务上下文,创建了一个向量存储索引。
from llama_index import VectorStoreIndex
from llama_index import ServiceContext
from llama_index.llms import OpenAI
# 设置使用的大模型
# "gpt-3.5-turbo"是模型的名称
# temperature是温度,用来控制文本生成过程中的多样性
llm = OpenAI(model="gpt-3.5-turbo", temperature=0.1)
# 设置embedding模型
# 这里是在本地使用BAAI/bge-small-zh-v1.5
# document的所有的内容会索引到sentence index对象中
# 国内使用可以切换huggingface镜像站
service_context = ServiceContext.from_defaults(
llm=llm, embed_model="local:BAAI/bge-small-zh-v1.5"
)
index = VectorStoreIndex.from_documents([document],
service_context=service_context)# llm = OpenAI(model="gpt-3.5-turbo", temperature=0.1)
service_context_en = ServiceContext.from_defaults(
llm=llm, embed_model="local:BAAI/bge-small-en-v1.5"
)
index_en = VectorStoreIndex.from_documents([document_en],
service_context=service_context_en)将之前创建的向量存储索引转换为查询引擎,以便后续进行查询操作。
query_engine = index.as_query_engine()
query_engine_en = index_en.as_query_engine()使用查询引擎执行了一个查询操作,查询给定的问题。
response = query_engine.query(
"在寻找项目以积累经验时应采取哪些步骤?"
)
print(str(response))Output
在寻找项目以积累经验时,应该首先明确制定目标并确保能够实现这些目标。然后需要建立一个可预测的世界模型,将整个世界状态用数学模型表现出来,并能够预测它们的行为将如何改变这个世界。在多Agent中,可以通过合作和竞争的方式去完成一定的目标,利用演化算法和群体智能来达成一个整体的突现行为目标。最后,需要通过智能推理来得到新的知识,结合先验知识和特定的推理规则,以便积累更多经验。
response_en = query_engine_en.query(
"What are steps to take when finding projects to build your experience?"
)
print(str(response_en))Output
Develop a side hustle, ensure the project will help you grow technically, collaborate with good teammates, and consider if the project can serve as a stepping stone to larger projects.
二、使用TruLens进行评测
eval_questions = []
with open('data/eval_questions.txt', 'r') as file:
for line in file:
# Remove newline character and convert to integer
item = line.strip()
print(item)
eval_questions.append(item)Output
人工智能中的先验知识是如何被存储的? 人工智能的自我更新和自我提升是否可能导致其脱离人类的控制? 管理者如何管理AI? 强人工智能是什么? 人工智能被滥用带来的危害?
eval_questions_en = []
with open('data/eval_questions_en.txt', 'r') as file:
for line in file:
# Remove newline character and convert to integer
item = line.strip()
print(item)
eval_questions_en.append(item)Output
What are the keys to building a career in AI? How can teamwork contribute to success in AI? What is the importance of networking in AI? What are some good habits to develop for a successful career? How can altruism be beneficial in building a career? What is imposter syndrome and how does it relate to AI? Who are some accomplished individuals who have experienced imposter syndrome? What is the first step to becoming good at AI? What are some common challenges in AI? Is it normal to find parts of AI challenging?
加上自定义问题。
# You can try your own question:
new_question = "什么是适合我的人工智能工作?"
eval_questions.append(new_question)eval_questionsOutput
['人工智能中的先验知识是如何被存储的?', '人工智能的自我更新和自我提升是否可能导致其脱离人类的控制?', '管理者如何管理AI?', '强人工智能是什么?', '人工智能被滥用带来的危害?', '什么是适合我的人工智能工作?']
# You can try your own question:
new_question_en = "What is the right AI job for me?"
eval_questions_en.append(new_question_en)
eval_questions_enOutput
['What are the keys to building a career in AI?', 'How can teamwork contribute to success in AI?', 'What is the importance of networking in AI?', 'What are some good habits to develop for a successful career?', 'How can altruism be beneficial in building a career?', 'What is imposter syndrome and how does it relate to AI?', 'Who are some accomplished individuals who have experienced imposter syndrome?', 'What is the first step to becoming good at AI?', 'What are some common challenges in AI?', 'Is it normal to find parts of AI challenging?', 'What is the right AI job for me?']
通过调用 reset_database() 方法重置 Trulens 数据库。清空之前的记录和反馈数据。
首先需要安装本课程中需要的评估框架,如果已经安装就可以跳过这一步骤。
# requirements
# pip install trulens_eval# 导入Tru类
from trulens_eval import Tru
# 实例化Tru类
tru = Tru()
# 重置数据库
# 数据库之后会用来存储问题、中间召回结果、答案以及评估结果
tru.reset_database()Output
🦑 Tru initialized with db url sqlite:///default.sqlite . 🛑 Secret keys may be written to the database. See the `database_redact_keys` option of `Tru` to prevent this.
使用 get_prebuilt_trulens_recorder 函数创建一个 Trulens 记录器 (tru_recorder),该记录器与给定的查询引擎 (query_engine) 相关联。同时,指定了应用程序的标识为 "Direct Query Engine"。
from utils import get_prebuilt_trulens_recorder
tru_recorder = get_prebuilt_trulens_recorder(query_engine,
app_id="Direct Query Engine")
tru_recorder_en = get_prebuilt_trulens_recorder(query_engine_en,
app_id="Direct Query Engine_en")使用 tru_recorder 记录器开始记录过程,遍历 eval_questions 列表,对每个问题进行查询,并将查询引擎的响应记录下来。
with tru_recorder as recording:
for question in eval_questions:
response = query_engine.query(question)with tru_recorder_en as recording_en:
for question in eval_questions_en:
response_en = query_engine_en.query(question)获取 Trulens 记录和反馈数据。用于后续分析和评估。
records, feedback = tru.get_records_and_feedback(app_ids=[])records.head()Output
app_id app_json \
0 Direct Query Engine {"tru_class_info": {"name": "TruLlama", "modul...
1 Direct Query Engine {"tru_class_info": {"name": "TruLlama", "modul...
2 Direct Query Engine {"tru_class_info": {"name": "TruLlama", "modul...
3 Direct Query Engine {"tru_class_info": {"name": "TruLlama", "modul...
4 Direct Query Engine {"tru_class_info": {"name": "TruLlama", "modul...
type \
0 RetrieverQueryEngine(llama_index.query_engine....
1 RetrieverQueryEngine(llama_index.query_engine....
2 RetrieverQueryEngine(llama_index.query_engine....
3 RetrieverQueryEngine(llama_index.query_engine....
4 RetrieverQueryEngine(llama_index.query_engine....
record_id \
0 record_hash_8631870172f29b7facfc339a7c52c465
1 record_hash_c7d94d33ddf370a8172a8ce8da3b70ec
2 record_hash_80e60e443d0b66da0c5879fde60f2163
3 record_hash_1b323b65311a8cdfa6512765d88c3abb
4 record_hash_54ac38298eed725ca9879c20b65b6ad0
input \
0 "\u4eba\u5de5\u667a\u80fd\u4e2d\u7684\u5148\u9...
1 "\u4eba\u5de5\u667a\u80fd\u7684\u81ea\u6211\u6...
2 "\u7ba1\u7406\u8005\u5982\u4f55\u7ba1\u7406AI\...
3 "\u5f3a\u4eba\u5de5\u667a\u80fd\u662f\u4ec0\u4...
4 "\u4eba\u5de5\u667a\u80fd\u88ab\u6ee5\u7528\u5...
output tags \
0 "\u5148\u9a8c\u77e5\u8bc6\u5728\u4eba\u5de5\u6... -
1 "\u4eba\u5de5\u667a\u80fd\u7684\u81ea\u6211\u6... -
2 "Management of AI by managers involves treatin... -
3 "\u5f3a\u4eba\u5de5\u667a\u80fd\u662f\u4e00\u7... -
4 "The misuse of artificial intelligence technol... -
record_json \
0 {"record_id": "record_hash_8631870172f29b7facf...
1 {"record_id": "record_hash_c7d94d33ddf370a8172...
2 {"record_id": "record_hash_80e60e443d0b66da0c5...
3 {"record_id": "record_hash_1b323b65311a8cdfa65...
4 {"record_id": "record_hash_54ac38298eed725ca98...
cost_json \
0 {"n_requests": 0, "n_successful_requests": 0, ...
1 {"n_requests": 0, "n_successful_requests": 0, ...
2 {"n_requests": 0, "n_successful_requests": 0, ...
3 {"n_requests": 0, "n_successful_requests": 0, ...
4 {"n_requests": 0, "n_successful_requests": 0, ...
perf_json \
0 {"start_time": "2024-03-12T13:22:02.775333", "...
1 {"start_time": "2024-03-12T13:22:06.220520", "...
2 {"start_time": "2024-03-12T13:22:08.469294", "...
3 {"start_time": "2024-03-12T13:22:11.565023", "...
4 {"start_time": "2024-03-12T13:22:14.764807", "...
ts Answer Relevance Context Relevance \
0 2024-03-12T13:22:06.003752 1.0 0.6
1 2024-03-12T13:22:08.290158 1.0 0.8
2 2024-03-12T13:22:11.210570 0.8 0.6
3 2024-03-12T13:22:14.306188 1.0 0.9
4 2024-03-12T13:22:17.776310 0.9 0.9
Groundedness Answer Relevance_calls \
0 1.000000 [{'args': {'prompt': '人工智能中的先验知识是如何被存储的?', 're...
1 0.733333 [{'args': {'prompt': '人工智能的自我更新和自我提升是否可能导致其脱离人...
2 0.000000 [{'args': {'prompt': '管理者如何管理AI?', 'response':...
3 0.500000 [{'args': {'prompt': '强人工智能是什么?', 'response': ...
4 0.666667 [{'args': {'prompt': '人工智能被滥用带来的危害?', 'respons...
Context Relevance_calls \
0 [{'args': {'prompt': '人工智能中的先验知识是如何被存储的?', 're...
1 [{'args': {'prompt': '人工智能的自我更新和自我提升是否可能导致其脱离人...
2 [{'args': {'prompt': '管理者如何管理AI?', 'response':...
3 [{'args': {'prompt': '强人工智能是什么?', 'response': ...
4 [{'args': {'prompt': '人工智能被滥用带来的危害?', 'respons...
Groundedness_calls latency total_tokens \
0 [{'args': {'source': '[10]
早期的⼈⼯智能研究⼈员直接模仿⼈类进⾏... 3 0
1 [{'args': {'source': '他认为各国应该强制订定规定AI机器只能⽤于⼈类不... 2 0
2 [{'args': {'source': '创造⼒
伦理管理
经济冲击
AI对⼈类的威胁
悲... 2 0
3 [{'args': {'source': '⾮⼈类的⼈⼯智能,即机器产⽣了和⼈完全不⼀样的知... 2 0
4 [{'args': {'source': '截⾄2020年12⽉,Sensity检测到的相关... 3 0
total_cost
0 0.0
1 0.0
2 0.0
3 0.0
4 0.0 | app_id | app_json | type | record_id | input | output | tags | record_json | cost_json | perf_json | ts | Answer Relevance | Context Relevance | Groundedness | Answer Relevance_calls | Context Relevance_calls | Groundedness_calls | latency | total_tokens | total_cost | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Direct Query Engine | {"tru_class_info": {"name": "TruLlama", "modul... | RetrieverQueryEngine(llama_index.query_engine.... | record_hash_8631870172f29b7facfc339a7c52c465 | "\u4eba\u5de5\u667a\u80fd\u4e2d\u7684\u5148\u9... | "\u5148\u9a8c\u77e5\u8bc6\u5728\u4eba\u5de5\u6... | - | {"record_id": "record_hash_8631870172f29b7facf... | {"n_requests": 0, "n_successful_requests": 0, ... | {"start_time": "2024-03-12T13:22:02.775333", "... | 2024-03-12T13:22:06.003752 | 1.0 | 0.6 | 1.000000 | [{'args': {'prompt': '人工智能中的先验知识是如何被存储的?', 're... | [{'args': {'prompt': '人工智能中的先验知识是如何被存储的?', 're... | [{'args': {'source': '[10] 早期的⼈⼯智能研究⼈员直接模仿⼈类进⾏... | 3 | 0 | 0.0 |
| 1 | Direct Query Engine | {"tru_class_info": {"name": "TruLlama", "modul... | RetrieverQueryEngine(llama_index.query_engine.... | record_hash_c7d94d33ddf370a8172a8ce8da3b70ec | "\u4eba\u5de5\u667a\u80fd\u7684\u81ea\u6211\u6... | "\u4eba\u5de5\u667a\u80fd\u7684\u81ea\u6211\u6... | - | {"record_id": "record_hash_c7d94d33ddf370a8172... | {"n_requests": 0, "n_successful_requests": 0, ... | {"start_time": "2024-03-12T13:22:06.220520", "... | 2024-03-12T13:22:08.290158 | 1.0 | 0.8 | 0.733333 | [{'args': {'prompt': '人工智能的自我更新和自我提升是否可能导致其脱离人... | [{'args': {'prompt': '人工智能的自我更新和自我提升是否可能导致其脱离人... | [{'args': {'source': '他认为各国应该强制订定规定AI机器只能⽤于⼈类不... | 2 | 0 | 0.0 |
| 2 | Direct Query Engine | {"tru_class_info": {"name": "TruLlama", "modul... | RetrieverQueryEngine(llama_index.query_engine.... | record_hash_80e60e443d0b66da0c5879fde60f2163 | "\u7ba1\u7406\u8005\u5982\u4f55\u7ba1\u7406AI\... | "Management of AI by managers involves treatin... | - | {"record_id": "record_hash_80e60e443d0b66da0c5... | {"n_requests": 0, "n_successful_requests": 0, ... | {"start_time": "2024-03-12T13:22:08.469294", "... | 2024-03-12T13:22:11.210570 | 0.8 | 0.6 | 0.000000 | [{'args': {'prompt': '管理者如何管理AI?', 'response':... | [{'args': {'prompt': '管理者如何管理AI?', 'response':... | [{'args': {'source': '创造⼒ 伦理管理 经济冲击 AI对⼈类的威胁 悲... | 2 | 0 | 0.0 |
| 3 | Direct Query Engine | {"tru_class_info": {"name": "TruLlama", "modul... | RetrieverQueryEngine(llama_index.query_engine.... | record_hash_1b323b65311a8cdfa6512765d88c3abb | "\u5f3a\u4eba\u5de5\u667a\u80fd\u662f\u4ec0\u4... | "\u5f3a\u4eba\u5de5\u667a\u80fd\u662f\u4e00\u7... | - | {"record_id": "record_hash_1b323b65311a8cdfa65... | {"n_requests": 0, "n_successful_requests": 0, ... | {"start_time": "2024-03-12T13:22:11.565023", "... | 2024-03-12T13:22:14.306188 | 1.0 | 0.9 | 0.500000 | [{'args': {'prompt': '强人工智能是什么?', 'response': ... | [{'args': {'prompt': '强人工智能是什么?', 'response': ... | [{'args': {'source': '⾮⼈类的⼈⼯智能,即机器产⽣了和⼈完全不⼀样的知... | 2 | 0 | 0.0 |
| 4 | Direct Query Engine | {"tru_class_info": {"name": "TruLlama", "modul... | RetrieverQueryEngine(llama_index.query_engine.... | record_hash_54ac38298eed725ca9879c20b65b6ad0 | "\u4eba\u5de5\u667a\u80fd\u88ab\u6ee5\u7528\u5... | "The misuse of artificial intelligence technol... | - | {"record_id": "record_hash_54ac38298eed725ca98... | {"n_requests": 0, "n_successful_requests": 0, ... | {"start_time": "2024-03-12T13:22:14.764807", "... | 2024-03-12T13:22:17.776310 | 0.9 | 0.9 | 0.666667 | [{'args': {'prompt': '人工智能被滥用带来的危害?', 'respons... | [{'args': {'prompt': '人工智能被滥用带来的危害?', 'respons... | [{'args': {'source': '截⾄2020年12⽉,Sensity检测到的相关... | 3 | 0 | 0.0 |
运行 Trulens 仪表板以可视化评估结果。
# launches on http://localhost:8501/
tru.run_dashboard()三、高级的RAG通道
3.1 滑窗句子检索
创建 OpenAI 的 GPT-3.5-turbo 语言模型实例:
from llama_index.llms import OpenAI
llm = OpenAI(model="gpt-3.5-turbo", temperature=0.1)使用辅助函数 build_sentence_window_index 创建基于窗口的句子索引:
from utils import build_sentence_window_index
sentence_index = build_sentence_window_index(
document,
llm,
embed_model="local:BAAI/bge-small-zh-v1.5",
save_dir="sentence_index"
)sentence_index_en = build_sentence_window_index(
document_en,
llm,
embed_model="local:BAAI/bge-small-en-v1.5",
save_dir="sentence_index_en"
)使用辅助函数 get_sentence_window_query_engine 获取基于句子窗口的查询引擎:
from utils import get_sentence_window_query_engine
# 根据sentence_index对象创建一个搜索引擎
# 之后会被用于在RAG应用中进行召回
sentence_window_engine = get_sentence_window_query_engine(sentence_index)sentence_window_engine_en = get_sentence_window_query_engine(sentence_index_en)对一个特定的问题进行查询并打印结果:
window_response = sentence_window_engine.query(
"如何开始人工智能个人项目?"
)
str(window_response)Output
'通过模仿人类思考模式,尝试逐步推理是一个开始人工智能个人项目的方法。另外,利用概率和经济学概念处理不确定或不完整的信息也是一个成功的方法。在解决困难问题时,寻找更有效的算法是优先考虑的。最终,强调感知运动的重要性也是一个可以考虑的方向。'
window_response_en = sentence_window_engine_en.query(
"how do I get started on a personal project in AI?"
)
str(window_response_en)Output
"To get started on a personal project in AI, it is important to first identify a project that aligns with your career goals and interests. Once you have chosen a project, you can begin by scoping it out, defining the objectives, and outlining the steps needed to achieve them. It's essential to ensure that the project is responsible, ethical, and beneficial to people. As you work on the project, aim to grow in terms of scope, complexity, and impact over time. Building a portfolio of projects that demonstrate skill progression can also be valuable for your career development in AI."
重置 Trulens 数据库,
使用 Trulens 记录器对基于窗口的句子索引进行评估,记录查询结果:
tru.reset_database()
tru_recorder_sentence_window = get_prebuilt_trulens_recorder(
sentence_window_engine,
app_id = "Sentence Window Query Engine"
)tru_recorder_sentence_window_en = get_prebuilt_trulens_recorder(
sentence_window_engine_en,
app_id = "Sentence Window Query Engine_en"
)for question in eval_questions:
with tru_recorder_sentence_window as recording:
response = sentence_window_engine.query(question)
print(question)
print(str(response))Output
人工智能中的先验知识是如何被存储的? 人工智能中的先验知识是通过某种方式告知机器的知识,可以描述目标、特征、种类及对象之间的关系,也可以描述事件、时间、状态、原因和结果,以及任何需要机器存储的知识。 人工智能的自我更新和自我提升是否可能导致其脱离人类的控制? 人工智能的自我更新和自我提升可能导致其脱离人类的控制。 管理者如何管理AI? Managers can manage AI by considering the following suggestions: 1. Delegate administrative tasks. 2. Focus on enhancing their comprehensive judgment and creativity in the field of analysis and prediction. 3. Treat AI as a colleague and form a collaborative team. 4. Recognize that all technologies, including AI, have limitations and may face bottlenecks. 强人工智能是什么? 强人工智能是一种观点,认为计算机本身具有思维,而不仅仅是用来模拟人类思维的工具。根据这个观点,只要计算机运行适当的程序,它们就具有自己的思维能力。 人工智能被滥用带来的危害? The misuse of artificial intelligence could potentially lead to violations of copyright laws and other legal regulations. There have been cases where artificial intelligence technology has been used to remove mosaic from explicit videos, alter the appearance of individuals in videos, and other related incidents. Additionally, experts have raised concerns about the potential misuse of artificial intelligence in manipulating financial markets, scientists, human leaders, and even developing weapons that may be beyond human comprehension and control. Furthermore, there are predictions that certain professions could be replaced by machines and artificial intelligence in the future, impacting millions of individuals and potentially leading to social instability. 什么是适合我的人工智能工作? 适合您的人工智能工作是那些需要您具备观察周围环境、作出行动以达成目标的能力,同时能够正确解释外部数据、学习并利用知识实现特定目标和任务的工作。这样的工作可能涉及模仿人类思维相关的认知功能,包括学习和解决问题,并需要您具备感知环境、采取行动以最大程度提高成功机会的能力。
for question in eval_questions_en:
with tru_recorder_sentence_window_en as recording:
response = sentence_window_engine.query(question)
print(question)
print(str(response))Output
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function BaseQueryEngine.query at 0x000001E7720134C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.indices.vector_store.retrievers.retriever.VectorIndexRetriever'> at 0x1e716c1fa90 is calling an instrumented method <function BaseRetriever.retrieve at 0x000001E77483AD40>. The path of this call may be incorrect. Guessing path of new object is app.retriever based on other object (0x1e71699c5d0) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function CompactAndRefine.get_response at 0x000001E77480B1A0>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What are the keys to building a career in AI? Understanding the characteristics of intelligent systems, studying introductory materials on artificial intelligence, and gaining expertise in problem solving, puzzle solving, game playing, and deduction are key elements to building a career in AI.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
How can teamwork contribute to success in AI? Teamwork can contribute to success in AI by treating AI as a colleague and forming a collaborative team. This approach fosters synergy and cooperation, allowing for a more effective utilization of AI technologies within various processes and creative endeavors.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What is the importance of networking in AI? Networking in AI is crucial as it allows for the exchange of information and collaboration among researchers, experts, and professionals in the field. Through networking, individuals can share insights, best practices, and advancements in artificial intelligence, fostering innovation and progress in the development of AI technologies. Additionally, networking provides opportunities for partnerships, joint projects, and knowledge sharing, which are essential for the growth and evolution of AI applications across various industries and domains.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What are some good habits to develop for a successful career? Developing habits such as relinquishing administrative tasks and focusing on enhancing comprehensive judgment skills can be beneficial for a successful career.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
How can altruism be beneficial in building a career? Altruism can be beneficial in building a career by fostering positive relationships, creating a supportive network, and enhancing one's reputation within a professional community. It can also lead to opportunities for collaboration, mentorship, and personal growth, ultimately contributing to long-term career success.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What is imposter syndrome and how does it relate to AI? Imposter syndrome is a psychological pattern where individuals doubt their accomplishments and have a persistent fear of being exposed as a fraud. In the context of AI, imposter syndrome can manifest among researchers or professionals who may feel inadequate or fraudulent in their work within the highly technical and specialized field of artificial intelligence. This feeling may arise due to the complexity and vast scope of AI research, leading individuals to question their own abilities and knowledge in comparison to the breadth of the field.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
Who are some accomplished individuals who have experienced imposter syndrome? Stephen Hawking and Elon Musk are some accomplished individuals who have experienced imposter syndrome.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What is the first step to becoming good at AI? Studying and understanding the complex mathematical tools developed in artificial intelligence research to solve specific branch problems is the first step to becoming proficient in AI.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What are some common challenges in AI? Some common challenges in AI include the fragmentation of AI into subfields that may not communicate effectively with each other, difficulties in areas such as vision, natural language processing, decision theory, genetic algorithms, and robotics, and the potential ethical concerns surrounding the development and deployment of AI technologies.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
Is it normal to find parts of AI challenging? It is common for individuals to find certain aspects of Artificial Intelligence challenging.
A new object of type <class 'llama_index.query_engine.retriever_query_engine.RetrieverQueryEngine'> at 0x1e71800dbd0 is calling an instrumented method <function RetrieverQueryEngine.retrieve at 0x000001E779B307C0>. The path of this call may be incorrect. Guessing path of new object is app based on other object (0x1e7167b0190) using this function. A new object of type <class 'llama_index.response_synthesizers.compact_and_refine.CompactAndRefine'> at 0x1e717f6fd90 is calling an instrumented method <function Refine.get_response at 0x000001E774838860>. The path of this call may be incorrect. Guessing path of new object is app._response_synthesizer based on other object (0x1e7167b01d0) using this function.
What is the right AI job for me? A suitable AI job for you would involve working in the field of data science or artificial intelligence. These areas are in high demand and offer various opportunities for individuals with the right skills and expertise. Consider roles such as data scientist, AI specialist, machine learning engineer, or AI researcher, depending on your interests and qualifications.
获取性能评估的排行榜:
tru.get_leaderboard(app_ids=[])Output
Groundedness Answer Relevance \
app_id
Sentence Window Query Engine 0.811111 0.916667
Sentence Window Query Engine_en 0.300000 0.920000
Context Relevance latency total_cost
app_id
Sentence Window Query Engine 0.741667 4.000000 0.0
Sentence Window Query Engine_en 0.070000 3.727273 0.0 | Groundedness | Answer Relevance | Context Relevance | latency | total_cost | |
|---|---|---|---|---|---|
| app_id | |||||
| Sentence Window Query Engine | 0.811111 | 0.916667 | 0.741667 | 4.000000 | 0.0 |
| Sentence Window Query Engine_en | 0.300000 | 0.920000 | 0.070000 | 3.727273 | 0.0 |
# launches on http://localhost:8501/
tru.run_dashboard()3.2 自动合并检索
from utils import build_automerging_index
automerging_index = build_automerging_index(
documents,
llm,
embed_model="local:BAAI/bge-small-zh-v1.5",
save_dir="merging_index"
)automerging_index_en = build_automerging_index(
documents_en,
llm,
embed_model="local:BAAI/bge-small-en-v1.5",
save_dir="merging_index_en"
)from utils import get_automerging_query_engine
automerging_query_engine = get_automerging_query_engine(
automerging_index,
)automerging_query_engine_en = get_automerging_query_engine(
automerging_index_en,
)auto_merging_response = automerging_query_engine.query(
"如何开始人工智能个人项目?"
)
print(str(auto_merging_response))Output
Begin a personal artificial intelligence project by first identifying a specific problem or application you want to work on. Then, explore various tools and technologies that can help you achieve your project goals. Design and create your project with a focus on utilizing different tools to implement the desired application effectively.
auto_merging_response_en = automerging_query_engine_en.query(
"how do I get started on a personal project in AI?"
)
print(str(auto_merging_response_en))Output
To get started on a personal project in AI, communicating the value of what you hope to build can help bring colleagues, mentors, and managers onboard. This will also help them point out any flaws in your reasoning. After finishing the project, being able to clearly explain what you accomplished will help convince others to open the door to larger projects. Additionally, starting with small projects in your spare time and achieving initial successes, no matter how small, can help build your skills and increase your ability to come up with better ideas. Joining existing projects or finding someone with an idea to collaborate with can also be a good way to kickstart your personal project in AI.
tru.reset_database()
tru_recorder_automerging = get_prebuilt_trulens_recorder(automerging_query_engine,
app_id="Automerging Query Engine")
tru_recorder_automerging_en = get_prebuilt_trulens_recorder(automerging_query_engine_en,
app_id="Automerging Query Engine_en")for question in eval_questions:
with tru_recorder_automerging as recording:
response = automerging_query_engine.query(question)
print(question)
print(response)Output
> Merging 4 nodes into parent node. > Parent node id: 610d624d-381b-4f98-a6df-b6d88b59cca8. > Parent node text: [16] ⼈类解决问题的模式通常是⽤最快捷、直观的判断,⽽不是有意识的、⼀步⼀步的推导,早期⼈⼯智能研究通常使⽤逐步推导的⽅式。[17]⼈⼯智能研究已经 于这种“次表征性的”解决问题⽅法获取进展... 人工智能中的先验知识是如何被存储的? In artificial intelligence, prior knowledge is stored in a way that allows machines to retain descriptions of objectives, features, categories, and relationships between objects. It can also encompass descriptions of events, time, states, causes, results, or any knowledge that one wishes the machine to store. This stored knowledge can include both explicitly provided information and knowledge derived through intelligent reasoning processes. 人工智能的自我更新和自我提升是否可能导致其脱离人类的控制? Yes, the self-updating and self-improving capabilities of artificial intelligence could potentially lead to it surpassing human control. > Merging 2 nodes into parent node. > Parent node id: 0e4eeea0-999b-4905-9fce-9f7fa045325d. > Parent node text: 依⽬前的研究⽅向,电脑⽆法突变、苏醒、产⽣⾃我意志,AI也不可能具有创意与智能、同情⼼与审美等这⽅⾯的能⼒。 AI逐渐普及后,将会在企业管理中扮演很重要的⾓⾊,⽽⼈类的管理者应 如何适度的调整⾃... 管理者如何管理AI? Management should consider adjusting their work functions by relinquishing administrative tasks, focusing on enhancing their comprehensive judgment abilities, and emphasizing creativity, ethical management, and economic impacts. It is important for managers to understand the potential threats of AI and be prepared to adapt to the changing landscape of AI integration in business management. 强人工智能是什么? 强人工智能是指一种观点,认为可以制造出真正能够推理和解决问题的智能机器,这样的机器被认为具有知觉和自我意识。 人工智能被滥用带来的危害? The misuse of artificial intelligence technology can potentially violate copyright laws and other legal regulations. There have been instances where law enforcement has intervened due to the use of AI technology to remove mosaic from explicit images or alter the content of images. Additionally, the misuse of AI can lead to societal instability if the number of individuals negatively impacted is significant, potentially creating a destabilizing force that could be exploited by malicious actors, resulting in various incidents. 什么是适合我的人工智能工作? 适合您的人工智能工作是那些需要感知环境、采取行动、从经验中学习、做出合理决策并快速回应的工作,以及可能涉及制造真正能推理和解决问题的智能机器的工作。
for question in eval_questions_en:
with tru_recorder_automerging_en as recording:
response = automerging_query_engine_en.query(question)
print(question)
print(response)Output
> Merging 2 nodes into parent node. > Parent node id: 4daa536d-f162-4f96-9724-825d766babe2. > Parent node text: PAGE 3Table of ContentsIntroduction: Coding AI is the New Literacy. Chapter 1: Three Steps to Ca... > Merging 1 nodes into parent node. > Parent node id: 9a1060af-8768-4591-9737-e6295af6ad39. > Parent node text: PAGE 3Table of ContentsIntroduction: Coding AI is the New Literacy. Chapter 1: Three Steps to Ca... What are the keys to building a career in AI? The keys to building a career in AI are learning foundational technical skills, working on projects to deepen skills and create impact, and finding a job in the field. Being part of a community also supports these steps. How can teamwork contribute to success in AI? Teamwork can contribute to success in AI by enabling individuals to collaborate effectively, influence others, and be influenced by team members. Working in teams on large projects in AI can enhance the overall success as it allows for diverse perspectives, shared knowledge, and collective problem-solving capabilities. > Merging 3 nodes into parent node. > Parent node id: 2a3c89c2-9e1f-4aa1-a041-a8e3f7b545de. > Parent node text: PAGE 35Keys to Building a Career in AI CHAPTER 10 The path to career success in AI is more comple... > Merging 1 nodes into parent node. > Parent node id: af74273b-3def-4687-9aec-2ed8e82819b9. > Parent node text: PAGE 35Keys to Building a Career in AI CHAPTER 10 The path to career success in AI is more comple... What is the importance of networking in AI? Networking in AI is crucial as it helps individuals build a strong professional network within the industry. This network can provide support, guidance, and opportunities for career advancement. By connecting with others in the field, individuals can gain valuable insights, stay updated on industry trends, and potentially find mentors who can help them navigate their career paths effectively. > Merging 2 nodes into parent node. > Parent node id: 6235c1a4-7061-4e82-a58e-8090b4c9aa1f. > Parent node text: PAGE 36Keys to Building a Career in AI CHAPTER 10 Of all the steps in building a career, this on... > Merging 2 nodes into parent node. > Parent node id: bef5e149-069f-4a76-99c0-a35bcdc8d2f7. > Parent node text: PAGE 11 The Best Way to Build a New Habit One of my favorite books is BJ Fogg’s, Tiny Habits: Th... > Merging 1 nodes into parent node. > Parent node id: 40b951a1-f670-423d-90d8-a4133bea59f9. > Parent node text: PAGE 36Keys to Building a Career in AI CHAPTER 10 Of all the steps in building a career, this on... > Merging 1 nodes into parent node. > Parent node id: 236499b9-afbc-4048-bf4c-f4abe1d1f6ed. > Parent node text: PAGE 11 The Best Way to Build a New Habit One of my favorite books is BJ Fogg’s, Tiny Habits: Th... What are some good habits to develop for a successful career? Good habits to develop for a successful career include habits related to eating well, exercising, getting enough sleep, maintaining personal relationships, staying dedicated to work, continuous learning, and self-care. These habits can help individuals progress in their careers while also ensuring their overall well-being. How can altruism be beneficial in building a career? Altruism can be beneficial in building a career by helping individuals lift others during their journey, which often leads to achieving better outcomes for themselves. This approach of supporting and helping others can create a positive network and community that can provide assistance and guidance when needed, ultimately propelling one forward in their career. > Merging 5 nodes into parent node. > Parent node id: 078fd2d1-a75f-46ea-80a2-a304afd202a1. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... > Merging 1 nodes into parent node. > Parent node id: cafdfa80-e3ec-4877-825a-974ab062bd7c. > Parent node text: PAGE 37Overcoming Imposter SyndromeCHAPTER 11 > Merging 3 nodes into parent node. > Parent node id: cb9e385b-2d74-46b9-8452-3d41cd2609ef. > Parent node text: PAGE 39My three-year-old daughter (who can barely count to 12) regularly tries to teach things to... > Merging 1 nodes into parent node. > Parent node id: 33a81b18-db5a-4170-b2dd-9746b79325d7. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... > Merging 1 nodes into parent node. > Parent node id: 977dfbae-8938-4e93-a6cc-ea55a9a46cce. > Parent node text: PAGE 37Overcoming Imposter SyndromeCHAPTER 11 > Merging 1 nodes into parent node. > Parent node id: 07b83924-cf67-4952-bf27-b07f1b10e439. > Parent node text: PAGE 39My three-year-old daughter (who can barely count to 12) regularly tries to teach things to... What is imposter syndrome and how does it relate to AI? Imposter syndrome is a phenomenon where individuals doubt their accomplishments and have a persistent fear of being exposed as a fraud, despite evidence of their competence. In the context of AI, newcomers to the field may experience imposter syndrome due to the technical complexity and the presence of highly capable individuals within the AI community. It can lead individuals to question their abilities and whether they truly belong in the AI field, even if they have achieved success. > Merging 3 nodes into parent node. > Parent node id: 078fd2d1-a75f-46ea-80a2-a304afd202a1. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... > Merging 1 nodes into parent node. > Parent node id: cafdfa80-e3ec-4877-825a-974ab062bd7c. > Parent node text: PAGE 37Overcoming Imposter SyndromeCHAPTER 11 > Merging 3 nodes into parent node. > Parent node id: cb9e385b-2d74-46b9-8452-3d41cd2609ef. > Parent node text: PAGE 39My three-year-old daughter (who can barely count to 12) regularly tries to teach things to... > Merging 1 nodes into parent node. > Parent node id: 33a81b18-db5a-4170-b2dd-9746b79325d7. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... > Merging 1 nodes into parent node. > Parent node id: 977dfbae-8938-4e93-a6cc-ea55a9a46cce. > Parent node text: PAGE 37Overcoming Imposter SyndromeCHAPTER 11 > Merging 1 nodes into parent node. > Parent node id: 07b83924-cf67-4952-bf27-b07f1b10e439. > Parent node text: PAGE 39My three-year-old daughter (who can barely count to 12) regularly tries to teach things to... Who are some accomplished individuals who have experienced imposter syndrome? Sheryl Sandberg, Michelle Obama, Tom Hanks, and Mike Cannon-Brookes are some accomplished individuals who have experienced imposter syndrome. What is the first step to becoming good at AI? The first step to becoming good at AI is to suck at it. What are some common challenges in AI? Some common challenges in AI include the highly iterative nature of AI projects, difficulties in project management due to uncertainty in time estimates for achieving target accuracy, and technical challenges that many individuals face when working on AI projects. > Merging 3 nodes into parent node. > Parent node id: 078fd2d1-a75f-46ea-80a2-a304afd202a1. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... > Merging 1 nodes into parent node. > Parent node id: 33a81b18-db5a-4170-b2dd-9746b79325d7. > Parent node text: PAGE 38Before we dive into the final chapter of this book, I’d like to address the serious matter... Is it normal to find parts of AI challenging? Yes, it is normal to find parts of AI challenging, as even accomplished individuals in the field have faced difficulties and struggles with various technical aspects of AI. > Merging 1 nodes into parent node. > Parent node id: 608bd2ca-f80e-4423-a79a-23b71fd1f85c. > Parent node text: PAGE 31Finding the Right AI Job for YouCHAPTER 9 JOBS > Merging 1 nodes into parent node. > Parent node id: e7fa6d16-64e1-47ac-9e52-3f0afd9cd16b. > Parent node text: If you’re leaving a job, exit gracefully. Give your employer ample notice, give your full effort... > Merging 1 nodes into parent node. > Parent node id: f6d586aa-09cb-403c-b76c-1d29984398fb. > Parent node text: PAGE 31Finding the Right AI Job for YouCHAPTER 9 JOBS What is the right AI job for me? The right AI job for you is one that aligns with your skills, interests, and career goals. It should be a position where you can continue to grow, learn, and contribute effectively to the field of artificial intelligence.
tru.get_leaderboard(app_ids=[])Output
Context Relevance Groundedness \
app_id
Automerging Query Engine 0.8000 0.908333
Automerging Query Engine_en 0.0375 0.333333
Answer Relevance latency total_cost
app_id
Automerging Query Engine 0.916667 3.666667 0.0
Automerging Query Engine_en 0.840000 3.545455 0.0 | Context Relevance | Groundedness | Answer Relevance | latency | total_cost | |
|---|---|---|---|---|---|
| app_id | |||||
| Automerging Query Engine | 0.8000 | 0.908333 | 0.916667 | 3.666667 | 0.0 |
| Automerging Query Engine_en | 0.0375 | 0.333333 | 0.840000 | 3.545455 | 0.0 |
# launches on http://localhost:8501/
tru.run_dashboard()Output
Starting dashboard ... Config file already exists. Skipping writing process. Credentials file already exists. Skipping writing process. Dashboard already running at path: Network URL: http://198.18.0.1:8501
<Popen: returncode: None args: ['streamlit', 'run', '--server.headless=True'...>
