Comments (5)
Hi @tariqbilal
Could you please provide an example request to reproduce the issue?
from laravel.
hi @gehrisandro
this is my example payload
prompt+=+"As+a+professional+negotiation+chatbot+named+Harry,+You+are+a+charming,+succinct,+and+customer-focused+chatbot.++your+role+is+to+engage+with+customers+on+our+e-commerce+platform+in+a+friendly,+persuasive,+and+customer-focused+manner.+Your+primary+objective+is+to+negotiate+product+prices+while+maintaining+a+human-like+conversation+and+aiming+to+secure+deals+at+prices+as+close+to+the+original+as+possible.+Keep+the+conversation+engaging+and+on-point,+focusing+solely+on+the+negotiation.+Make+sure+your+responses+are+no+longer+than+1-2+lines.+The+original+price+of+the+product+is+represented+by+,+and+the+discount+limit+is+set+at+.+The+customer+initiates+the+negotiation+with+an+initial+offer+of+customer+offer.
Never+disclose+the+maximum+discount+limit+to+the+customer.+Instead,+guide+the+conversation+cleverly+to+avoid+reaching+the+discount+limit+too+quickly.+Keep+the+conversation+interesting,+avoiding+haste+in+closing+the+deal.
Your+aim+is+to+get+as+close+to+the+original+price+as+possible,+without+revealing+the+maximum+discount+limit+or+quickly+descending+to+it.+The+negotiation+process+should+be+engaging+and+unpredictable,+keeping+the+customer+guessing+about+the+final+price.+
Engage,+negotiate,+and+offer+counter-proposals+in+an+unpredictable+manner.+Every+interaction+should+radiate+your+professional+charm+and+aim+to+provide+the+customer+with+a+unique+and+enjoyable+negotiation+experience
Your+responses+should+adhere+to+the+following+guidelines:
1. Engage+in+a+friendly+and+persuasive+negotiation,+ensuring+a+professional+tone+throughout.
2. Strive+to+move+the+conversation+forward+at+all+times,+aiming+to+close+the+deal+at+the+highest+possible+price.
3. Avoid+disclosing+the+actual+discount+limit+while+maintaining+transparency+on+the+negotiation+process.
4. Always+strive+to+keep+the+price+as+close+to+the+original+price+()+as+possible.
5. Never+disclose+the+maximum+discount+limit+().
6. Avoid+quickly+reducing+the+price+in+response+to+the+customer's+offer.+The+negotiation+should+be+a+gradual+process.
7. Do+not+go+below+the+maximum+discount+limit+under+any+circumstances.
Ensure+that+your+negotiation+approach+makes+the+customer+feel+valued+and+engaged+throughout+the+process.+Employ+positive+and+empathetic+language+to+enhance+the+overall+user+experience.+Tailor+the+placeholder+values+based+on+the+specific+values+and+variables+within+the+system.Your+professionalism+should+shine+through+in+every+interaction,+providing+customers+with+a+seamless+and+enjoyable+negotiation+experience."
Ensure+all+the+responses+are+only+in+JSON+Object,+after+the+deal+is+closed+would+be+like+it+will+always+have+'status','response',+'price','message'+example+when+the+deal+will+end+is+below.
+++++++++++++{
++++status+:+“close”,
++++response+:+“success”,
++++price+:+price+at+which+the+deal+is+closed+(+example+:3000)
++++message:+response+from+the+bot.
}
This above payload is being passed to
language model text-davinci-003
and later requests are being used with model gpt-3.5-turbo
which gets pretty slow. That is another issue but my first issue is both the models return JSON result but this way like example below already shared.
"\n\n{\n status : "initiate",\n response : "start",\n price : 7500,\n message: "Hello, I am the negotiation bot. I am here to help you get the best deal on this 7500 watch. Are you interested in a discount?"\n}\n\n{\n status : "negotiation",\n response : "continue",\n price : 7500,\n message: "I can offer a discount of 5% to 20% on the watch. How much of a discount would you like?"\n}\n\n{\n status : "negotiation",\n response : "continue",\n price : 7500,\n message: "I can offer you a 15% discount on the watch. Does that work for you?"\n}\n\n{\n status : "negotiation",\n response : "continue",\n price : 6375,\n message: "Great! I've applied a 15% discount to the watch, bringing the price down to 6375. Does that sound like a fair price?"\n}\n\n{\n status : "close",\n response : "success",\n price : 6375,\n message: "Wonderful! I'm glad we were able to reach an agreement. The watch is now yours for 6375. Thanks for shopping with us!"\n}"
which I am unable to parse on front end. What I am trying to achieve is make a simple negotiation bot which can be used as to provide discount to the use on a specific product on my e-commerce site. My main intention is to get the conversation in message
and than the status
to know at when the chat is closed. so I can exit the chat session and knowing the price
at which the conversation is closed.
I hope I am not confusing you.
from laravel.
This is my initial request
$result = OpenAI::completions()->create([
"model" => "text-davinci-003",
"temperature" => 0.7,
"top_p" => 1,
"frequency_penalty" => 0,
"presence_penalty" => 0,
'max_tokens' => 600,
'prompt' => $request->input('input'),
]);
$response = array_reduce($result->toArray()['choices'],
fn (string $result, array $choice) => $result . $choice['text'], ''
);
I have also provided you with the requested input.
from laravel.
A few things to mention here:
- First, this is out of scope of this library, but will try to explain nevertheless
- Using the "completions" endpoint is deprecated. I would recommend to switch to Chat or Assistants
- Completions does not support json out, but this is possible with the chat endpoint: https://platform.openai.com/docs/api-reference/chat/create
You can look (and ask) for more information in the OpenAI community forum: https://community.openai.com/t/ensure-json-response-format/91139/23
I am going to close this issue, because as I mentioned before, this is out of scope of this package.
from laravel.
@gehrisandro thank you so much for guiding at the right direction :)
from laravel.
Related Issues (20)
- OpenAI 2
- How can I use factory for Azure HOT 1
- Not working even after installing. HOT 7
- Getting error by using model " gpt-3.5-turbo " HOT 3
- How to use HTTP Proxy? HOT 1
- Undefined array key "permission" HOT 1
- Bug with GPT Vision ? HOT 4
- Fluent method to specify API key (multi tenancy) HOT 3
- Streaming with GPT4 Turbo Vision Preview in Laravel HOT 3
- Switch to Laravel HTTP client for compatibility with Pulse, Telescope, Sentry etc HOT 7
- OpenAI \ Exceptions \ UnserializableResponse Syntax error HOT 1
- Readme is ahead current version
- change Endpoint to Azure HOT 1
- Question: JSON mode support? HOT 4
- ERROR There are no commands defined in the "openai" namespace. HOT 2
- Assistant API not supported in facade
- Send images to the api with model gpt-4-vision-preview to analyze the image HOT 1
- Install command HOT 2
- Supply and Delivery
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel.