Socket
Socket
Sign inDemoInstall

bing-chat

Package Overview
Dependencies
4
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.2 to 0.2.3

2

build/index.d.ts

@@ -8,2 +8,3 @@ type Author = 'user' | 'bot';

messageType?: string;
variant?: string;
locale?: string;

@@ -29,2 +30,3 @@ market?: string;

messageType?: string;
variant?: string;
detail?: ChatMessageFull | ChatMessagePartial;

@@ -31,0 +33,0 @@ }

42

build/index.js

@@ -22,2 +22,14 @@ // src/bing-chat.ts

}
/**
* Sends a message to Bing Chat, waits for the response to resolve, and returns
* the response.
*
* If you want to receive a stream of partial responses, use `opts.onProgress`.
*
* @param message - The prompt message to send
* @param opts.conversationId - Optional ID of a conversation to continue (defaults to a random UUID)
* @param opts.onProgress - Optional callback which will be invoked every time the partial response is updated
*
* @returns The response from Bing Chat
*/
async sendMessage(text, opts = {}) {

@@ -31,3 +43,4 @@ const {

location,
messageType = "Chat"
messageType = "Chat",
variant = "Balanced"
} = opts;

@@ -98,2 +111,20 @@ let { conversationId, clientId, conversationSignature } = opts;

const locationStr = location ? `lat:${location.lat};long:${location.lng};re=${location.re || "1000m"};` : void 0;
const optionsSets = [
"nlu_direct_response_filter",
"deepleo",
"enable_debug_commands",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm"
];
if (variant == "Balanced") {
optionsSets.push("galileo");
} else {
optionsSets.push("clgalileo");
if (variant == "Creative") {
optionsSets.push("h3imaginative");
} else if (variant == "Precise") {
optionsSets.push("h3precise");
}
}
const params = {

@@ -103,10 +134,3 @@ arguments: [

source: "cib",
optionsSets: [
"nlu_direct_response_filter",
"deepleo",
"enable_debug_commands",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm"
],
optionsSets,
allowedMessageTypes: [

@@ -113,0 +137,0 @@ "Chat",

{
"name": "bing-chat",
"version": "0.2.2",
"version": "0.2.3",
"description": "Node.js client for the unofficial Bing Chat API.",

@@ -38,8 +38,8 @@ "author": "Travis Fischer <travis@transitivebullsh.it>",

"dependencies": {
"ws": "^8.12.0"
"ws": "^8.13.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/node": "^18.11.9",
"@types/uuid": "^9.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/node": "^18.15.3",
"@types/uuid": "^9.0.1",
"@types/ws": "^8.5.4",

@@ -49,9 +49,9 @@ "del-cli": "^5.0.0",

"husky": "^8.0.2",
"lint-staged": "^13.0.3",
"lint-staged": "^13.2.0",
"npm-run-all": "^4.1.5",
"ora": "^6.1.2",
"prettier": "^2.8.0",
"tsup": "^6.5.0",
"tsx": "^3.12.1",
"typedoc": "^0.23.21",
"prettier": "^2.8.4",
"tsup": "^6.6.3",
"tsx": "^3.12.5",
"typedoc": "^0.23.26",
"typedoc-plugin-markdown": "^3.13.6",

@@ -58,0 +58,0 @@ "typescript": "^4.9.3"

@@ -76,2 +76,11 @@ # Bing Chat API <!-- omit in toc -->

You can also add the the parameter `variant` to the `sendMessage` function to change the variant of the AI. The default is `Balanced`, but you can also use `Precise` or `Creative`.
```ts
const res = await api.sendMessage('Write a 500 word essay on frogs.', {
// change the variant to 'Precise'
variant: 'Creative'
})
```
## Projects

@@ -78,0 +87,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc