Skip to content

Query

labridge.tools.paper.shared_papers.query

All functions in this file need the authorization of the users before execution.

All Interactions should be returned as tool output.

labridge.tools.paper.shared_papers.query.PaperQueryTool

Bases: QueryEngineBaseTool

This tool is used to answer the query with access to the shared paper storage.

Source code in labridge\tools\paper\shared_papers\query.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class PaperQueryTool(QueryEngineBaseTool):
	r"""
	This tool is used to answer the query with access to the shared paper storage.
	"""
	def __init__(
		self,
		paper_query_engine: PaperQueryEngine,
		name=PAPER_QUERY_TOOL_NAME,
		description=PAPER_QUERY_TOOL_DESCRIPTION,
	):
		super().__init__(
			query_engine=paper_query_engine,
			name=name,
			description=description,
		)

	def log(self) -> ToolLog:
		r"""
		Get the log: specifically, the references.
		"""
		ref_infos: List[PaperInfo] = self.query_engine.get_ref_info()

		log_to_user = None
		log_to_system = {
			TOOL_OP_DESCRIPTION: f"User the {self.metadata.name} to answer the user's query.",
			TOOL_REFERENCES: [ref_info.dumps() for ref_info in ref_infos]
		}
		return ToolLog(
			tool_name=self.metadata.name,
			log_to_user=log_to_user,
			log_to_system=log_to_system,
		)

labridge.tools.paper.shared_papers.query.PaperQueryTool.log()

Get the log: specifically, the references.

Source code in labridge\tools\paper\shared_papers\query.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def log(self) -> ToolLog:
	r"""
	Get the log: specifically, the references.
	"""
	ref_infos: List[PaperInfo] = self.query_engine.get_ref_info()

	log_to_user = None
	log_to_system = {
		TOOL_OP_DESCRIPTION: f"User the {self.metadata.name} to answer the user's query.",
		TOOL_REFERENCES: [ref_info.dumps() for ref_info in ref_infos]
	}
	return ToolLog(
		tool_name=self.metadata.name,
		log_to_user=log_to_user,
		log_to_system=log_to_system,
	)