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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94d004dde4b043c13876327f103c7c35e21cfd5027aace5cb8df0f3b8c97248a
4
- data.tar.gz: b7abca34b3ca86d763fe170bd13ea469693a7dd62e135b59b068e2ab9aa8f7b6
3
+ metadata.gz: cdb69c32abfb02791b1c40cb741fbf29d9100bbd6d3d5f92a6576945a07317b1
4
+ data.tar.gz: 3752c2213cd1ac9581aed704c7cfb3bfe467c25521d6a42186509f4cfeff2d2a
5
5
  SHA512:
6
- metadata.gz: c5d6e51b5b420cdfedf8b8f1feed43fbd3ffa478d3a4783d16ad8ca80b9205d0d070d172342344d2997fc7cbe1369c811bcb1fd80dee37dc9f74a4b4713bab03
7
- data.tar.gz: dfc675d8e95290db9cfa45a6e0fefc80ea1df01197a3349e838428006c0ab24864b8fb89a9bc7a87081c37f673ce5b65df1aa6925f22c671ca35df79381a7cb4
6
+ metadata.gz: b6862ac01e2eea1ac50779021f3b9ccf7bd453b2448775426686803b50d9ac8e2f953c52bee0dba86d78294db0a97c1555bb00d8252bd4907a926fbbba7928f2
7
+ data.tar.gz: 1e1d62404858e7014b45bf4f701deac50ca1a28f89073b3e213b28a70f07bfee67d08b0d263b630ce33fb258a74018a63a75edc0ff5d40ee06fa4e68bdd6e0fc
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module AnyChat
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-anychat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto