@webless/headless
v0.1.2
Published
Headless JavaScript client for Webless search experiences.
Downloads
606
Readme
@webless/headless
Headless JavaScript SDK for building custom Webless search experiences in React, vanilla JavaScript, Webflow, or any client-side project.
import { createClient } from "@webless/headless";
const webless = createClient({
id: "YOUR_ID"
});
for await (const event of webless.stream("How does your platform work?")) {
if (event.type === "summary_part") {
summaryEl.textContent += event.text;
}
}By default this package targets:
https://api.webless.aiOverride apiBaseUrl when targeting another environment.
const webless = createClient({
id: "YOUR_ID",
version: "published",
apiBaseUrl: "https://api.webless.ai"
});Request Options
await webless.search({
query: "How does your platform work?",
pageUrl: window.location.href,
isPrivateSession: false,
markdown: true,
useHistory: false,
suggestionCount: 4
});Browser Global
<script src="https://cdn.example.com/webless-tag.global.js"></script>
<script>
const webless = window.WeblessTag.createClient({
id: "YOUR_ID"
});
</script>