Retrieve live web search results and show chat diagnostics
This commit is contained in:
@@ -587,15 +587,15 @@ final class WebToolsTests: XCTestCase {
|
||||
}
|
||||
|
||||
final class BuiltInToolsetTests: XCTestCase {
|
||||
func testDiscoveryAndSetupErrorWithoutExternalServer() async throws {
|
||||
func testDiscoveryAndEmptyQueryValidationWithoutExternalServer() async throws {
|
||||
let client = BuiltInWebTools(searchEndpoint: "")
|
||||
let tools = try await client.listTools()
|
||||
XCTAssertEqual(tools.map(\.name), ["retrieve_page", "web_search"])
|
||||
do {
|
||||
_ = try await client.callTool("web_search", argumentsJSON: Data(#"{"query":"tides"}"#.utf8))
|
||||
XCTFail("Expected a configuration error")
|
||||
_ = try await client.callTool("web_search", argumentsJSON: Data(#"{}"#.utf8))
|
||||
XCTFail("Expected a missing query error")
|
||||
} catch let error as StudioError {
|
||||
XCTAssertTrue(error.message.contains("SearXNG"))
|
||||
XCTAssertTrue(error.message.contains("query"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,10 +629,11 @@ final class ToolboxRepairTests: XCTestCase {
|
||||
XCTAssertTrue(result.reference.contains(page.absoluteString))
|
||||
let search = try XCTUnwrap(ChatWebLookup(message: "Search the web for tides & moon"))
|
||||
let found = try await search.resolve(searchEndpoint: endpoint)
|
||||
XCTAssertTrue(found.reference.contains("A fixture & summary"))
|
||||
let unavailable = try await search.resolve(searchEndpoint: "")
|
||||
XCTAssertTrue(unavailable.status.contains("SearXNG"))
|
||||
XCTAssertEqual(unavailable.browserFallback?.host, "duckduckgo.com")
|
||||
XCTAssertTrue(found.reference.contains("Test passage."))
|
||||
let follow = try XCTUnwrap(ChatWebLookup(message: "Find tides documentation at \(base.appending(path: "follow-root"))"))
|
||||
let followed = try await follow.resolve(searchEndpoint: "", prompt: "Find tides documentation")
|
||||
XCTAssertTrue(followed.reference.contains("The tides documentation was followed."))
|
||||
XCTAssertTrue(followed.reference.contains("/follow-detail"))
|
||||
}
|
||||
|
||||
func testLiveLaravelRetrieval() async throws {
|
||||
|
||||
Reference in New Issue
Block a user