wit-ai / wit-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby library for Wit.ai
License: Other
Ruby library for Wit.ai
License: Other
Hello guys,
Let's say I have this story:
Users says: Bye
Bot says: Have a good one!
Bots says: ByeBye
it work in the wit testing dashboard.
Now when I'm trying to get that by converse method repeatedly till I get the type stop, but the type is always "value"
client.converse("session_id", "Bye") returns
{"confidence"=>0.0010324002873500187, "type"=>"msg", "msg"=>"Have a good one!", "entities"=>{"goodbye"=>[{"confidence"=>0.9514085768812446, "type"=>"value", "value"=>"Bye"}]}}
and then I do it again it returns:
{"confidence"=>0.0008932824968469721, "type"=>"msg", "msg"=>"ByeBye", "entities"=>{"goodbye"=>[{"confidence"=>0.9514085768812446, "type"=>"value", "value"=>"Bye"}]}}
I tried passing the session as an empty hash for the first call and then fill it in with entities for the second time but nothing changes.
Pls help
Thanks
When I:
rsp = client.message('I need to add two numbers')
I get a response by asking the user a question, then I send to wit the reply:
rsp = client.converse('<what-is this...really?', 'two and two', {})
Two things happened here:
If the user replies within few seconds, my rsp will have "type" => "msg",
, if the user takes long to reply, say 1min, my rsp will be "type" => "action",
. I'm lost. Why not include a session id with all message responses? Am I conversing properly? I'm lost with that "unique_session_id". Is that some random string generated by the my server? If so, why?
WitException: The 'say' action should take 3 arguments: session_id, context, msg.
WitException: The 'error' action should take 3 arguments: session_id, context, error.
actions = {
:say => -> (session_id, msg) {
p msg
},
:merge => -> (session_id, context, entities, msg) {
return context
},
:error => -> (session_id, context) {
p 'Oops I don't know what to do.'
},
}
should be
actions = {
:say => -> (session_id, context, msg) {
p msg
},
:merge => -> (session_id, context, entities, msg) {
return context
},
:error => -> (session_id, context, error) {
p 'Oops I don't know what to do.'
},
}
According to 57bdeb4, the actions
hash is deprecated for Wit.new
. However, the examples still use it. Please update the examples, because to me there is no clear migration plan. There are only very general advices in https://wit.ai/blog/2017/07/27/sunsetting-stories
ruby examples/quickstart.rb TOZOS7QIT6TUQXOK326CU2LPGVZ4VG2K
'
hello
I, [2016-05-10T13:15:28.446386 #6346] INFO -- : Executing merge
/var/lib/gems/2.1.0/gems/wit-3.3.1/lib/wit.rb:112:inrun_actions_': undefined method
to_sym' for nil:NilClass (NoMethodError)
from /var/lib/gems/2.1.0/gems/wit-3.3.1/lib/wit.rb:128:inrun_actions_' from /var/lib/gems/2.1.0/gems/wit-3.3.1/lib/wit.rb:133:in
run_actions'
from /var/lib/gems/2.1.0/gems/wit-3.3.1/lib/wit.rb:144:ininteractive' from examples/quickstart.rb:37:in
basic.rb:19:in `block in <main>': undefined method `first_entity_value' for main:Object (NoMethodError)
I used the example, absolutely same
see discussion on pywit issue #2
Changing the log level throws the error:
Wit.logger.level = Logger::WARN
=> undefined method `logger' for Wit:Class
Also, a different error when setting the log level in the instance
Wit.new(logger: Logger::WARN, ...
=> undefined method `debug' for 2:Fixnum
,
حذف ,
حذف ریلیم ,
قوانین ,
توضیحات ,
تنظیم نام ,
تنظیم عکس ,
ترفیع ,
تنزل ,
راهنما ,
پاک کردن ,
kill chat ,
kill realm ,
تنزل ,
تنزل ,
تنظیم ,
قفل ,
دارنده ,
دارنده ,
صاحب ,
آیدی ,
صاحب ,
باز کردن ,
تنظیم حساسیت ,
تنظیمات ,
لیست مدیران ,
لینک جدید ,
لینک ,
لینک خصوصی ,
حذف غیرفعالین ,
حذف غیرفعالین ,
When I use this example from the Readme:
actions = {
:say => -> (session_id, context, msg) {
p msg
},
:merge => -> (session_id, context, entities, msg) {
return context
},
:error => -> (session_id, context, error) {
p 'Oops I don\'t know what to do.'
},
}
client = Wit.new access_token, actions
session = 'my-user-session-42'
context0 = ""
context1 = client.run_actions(session, 'what is the weather in London?', context0)
p "The session state is now: #{context1}"
Then the output is "The session state is now: "
It seems like the input context is always returned, not the output-context.
GAWAD-W
Do you want to request a feature, report a bug, or ask a question about wit-ruby?
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
What is the expected behavior?
If applicable, what is the App ID where you are experiencing this issue? If you do not provide this, we cannot help.
I am trying to develop a chatbot using wit.ai to mount it on my website, but from my localhost I do not have access to the online API ... I use Ruby on Rails and when I try the basic example of the repository Git the answer is' SocketError: Failed to open TCP connection to api.wit.ai:443 (getaddrinfo: Temporary failure in name resolution) ', use the' savon 'gem to verify if it had connection and it works for me, I do not know why wit does not do it. This is the example:
require 'wit'
def call
client = Wit.new(access_token: 'Y3Q......')
rsp = client.message('cuestion???')
puts("Yay, got Wit.ai response: #{rsp}")
end
Then in my console:
$ rails c
Running via Spring preloader in process 5322
Loading development environment (Rails 5.1.5)
2.3.1 :001 > obj = MessageController.new
=> #<MessageController:0x00000003624280 @_action_has_layout=true, @_routes=nil, @_request=nil, @_response=nil>
2.3.1 :002 > obj.call
SocketError: Failed to open TCP connection to api.wit.ai:443 (getaddrinfo: Temporary failure in name resolution)
from app/controllers/message_controller.rb:9:in `call'
from (irb):2
2.3.1 :003 >
Do you want to request a feature, report a bug, or ask a question about wit-ruby?
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
What is the expected behavior?
If applicable, what is the App ID where you are experiencing this issue? If you do not provide this, we cannot help.
Do you want to request a feature, report a bug, or ask a question about wit-ruby?
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
What is the expected behavior?
If applicable, what is the App ID where you are experiencing this issue? If you do not provide this, we cannot help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.