ask-anychat 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ask/anychat/client.rb +36 -0
- data/lib/ask/anychat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cdb69c32abfb02791b1c40cb741fbf29d9100bbd6d3d5f92a6576945a07317b1
|
|
4
|
+
data.tar.gz: 3752c2213cd1ac9581aed704c7cfb3bfe467c25521d6a42186509f4cfeff2d2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6862ac01e2eea1ac50779021f3b9ccf7bd453b2448775426686803b50d9ac8e2f953c52bee0dba86d78294db0a97c1555bb00d8252bd4907a926fbbba7928f2
|
|
7
|
+
data.tar.gz: 1e1d62404858e7014b45bf4f701deac50ca1a28f89073b3e213b28a70f07bfee67d08b0d263b630ce33fb258a74018a63a75edc0ff5d40ee06fa4e68bdd6e0fc
|
data/lib/ask/anychat/client.rb
CHANGED
|
@@ -55,6 +55,38 @@ module Ask
|
|
|
55
55
|
delete("#{agents_path(workspace)}/#{encode(handle)}")
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
# -- sources -----------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
# The sources an agent may read, oldest first.
|
|
61
|
+
def agent_sources(workspace, agent)
|
|
62
|
+
fetch_key(get(sources_path(workspace, agent)), "sources")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# One source, by the handle list_sources returns.
|
|
66
|
+
def agent_source(workspace, agent, source)
|
|
67
|
+
fetch_key(get("#{sources_path(workspace, agent)}/#{encode(source)}"), "source")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Every page this agent may read in a source — the manifest.
|
|
71
|
+
def agent_source_pages(workspace, agent, source)
|
|
72
|
+
fetch_key(get("#{sources_path(workspace, agent)}/#{encode(source)}/pages"), "pages")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# One page, as clean markdown, from the plane or from the website itself
|
|
76
|
+
# when the plane has nothing. Returns the full page hash with title,
|
|
77
|
+
# content, and source keys.
|
|
78
|
+
def agent_source_page(workspace, agent, source, reference)
|
|
79
|
+
get("#{sources_path(workspace, agent)}/#{encode(source)}/pages#{reference}")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Search the pages an agent may read within a source.
|
|
83
|
+
def agent_source_search(workspace, agent, source, query)
|
|
84
|
+
fetch_key(
|
|
85
|
+
get("#{sources_path(workspace, agent)}/#{encode(source)}/search", q: query),
|
|
86
|
+
"results"
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
58
90
|
# The headers every request carries. Public because it is the honest
|
|
59
91
|
# answer to "what does this client send?" — and because a caller swapping
|
|
60
92
|
# the connection under it should be able to keep them.
|
|
@@ -74,6 +106,10 @@ module Ask
|
|
|
74
106
|
"/api/#{API_VERSION}/workspaces/#{encode(workspace)}/agents"
|
|
75
107
|
end
|
|
76
108
|
|
|
109
|
+
def sources_path(workspace, agent)
|
|
110
|
+
"#{agents_path(workspace)}/#{encode(agent)}/sources"
|
|
111
|
+
end
|
|
112
|
+
|
|
77
113
|
def get(path, params = nil)
|
|
78
114
|
request(:get, path, params: params)
|
|
79
115
|
end
|
data/lib/ask/anychat/version.rb
CHANGED