zabirauf / elixir_wit Goto Github PK
View Code? Open in Web Editor NEWElixir client for the Wit API. Wit is the natural language engine for creating Bots.
License: MIT License
Elixir client for the Wit API. Wit is the natural language engine for creating Bots.
License: MIT License
When sending this request to Wit:
curl -XPOST 'https://api.wit.ai/converse?&context=%7B%22theater%22:%22Edwards%20Mira%20Mesa%22,%22showTime%22:%22today%22,%22movie%22:%22Zootopia%22%7D&session_id=2241e696-44b7-11e7-8a47-6c4008a5c1c2&v=20160526' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Bearer TOKEN'
I get this response:
{
"confidence" : 1,
"type" : "error"
}
It seems to be related to the context. If I change the request to this:
curl -XPOST 'https://api.wit.ai/converse?v=20170307&session_id=2241e696-44b7-11e7-8a47-6c4008a5c1c2&v=20160526' \
-d '{"theater":"Edwards","showTime":"today","movie":"Zootopia"}' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H 'Authorization: Bearer TOKEN'
I get the correct response:
{
"confidence" : 0.00978581436765204,
"type" : "msg",
"msg" : "Zootopia is shown at Edwards at today"
}
On line 80 there's a call to Map.update/3
. This gives me the error in the subject line.
Looking in the Elixir docs, there is a Map.update!/3
and a Map.update/4
. It seems like this could be a typo, but maybe I'm missing something?
If using this package in a project requiring modules that depend on the newest version of the :uuid module, the compilation will crash
Unchecked dependencies for environment dev:
* uuid (Hex package)
could not find an app file at "_build/dev/lib/uuid/ebin/uuid.app". This may happen if the dependency was not yet compiled, or you specified the wrong application name in your deps, or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies
This is because the latest version of the module has been renamed to app: elixir_uuid
yet the name is still UUID
to reproduce try to compile a project which depends on both elixir_wit and :guardian v0.14.6 and you'll be able to create the conflict on compilation.
In your weather example, the defaction fetch_weather/2
receives session
and context
. In your tests you're simply doing Map.put(context, "forecast" "sunny")
, but how would I go about getting access to the entities to see if location
was provided and if so, go hit an endpoint to pull the weather.
Wit.ai shows this example code:
getForecast({context, entities}) {
return new Promise(function(resolve, reject) {
var location = firstEntityValue(entities, "location")
if (location) {
context.forecast = 'sunny in ' + location; // we should call a weather API here
// ...
elixir_wit
currently depends on {:httpotion, "~> 2.2.0"}
. However, under elixir 1.3.x httpotion
2.2.x
has a known issue, which was fixed in httpotion
~> 3.0.0
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.