Git Product home page Git Product logo

wit-go's People

Contributors

chessai avatar jtliao avatar nickylogan avatar patapizza avatar plutov avatar stopachka avatar szrrizvi2 avatar thibaultleouay avatar trynity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wit-go's Issues

API Versioning not working

Since wit.ai v2 the wit-go is broken.
I thought NewClientWithVersion(token, DefaultVersion) would prevent this, as it calls the API with API versioning.
But the API may not send an old-fashioned result back.

It will not work with v2, but DefaultVersion = "20170307" don't ensure, that this version is used.

I think it is not an issue of wit-go, but with the API.
But to workaround this issue, it is needed to update wit-go to the latest version of the API.

Support for API version 20200513

The latest version of the API response contract doesn't seem to match the current struct definition. Are there any plans to support this, maybe in v2 (since this is definitely breaking)? Is it fine if I create a PR for this?

Failed to validate sample at index 0. Start must be less than end

While using the ValidateSamples method with the sample code shown in the docs : https://wit.ai/docs/http/20170307#post__samples_link

[{
        "text": "I want to fly to sfo",
        "entities": [
          {
            "entity": "intent",
            "value": "flight_request"
          },
          {
            "entity": "wit$location",
            "start": 17,
            "end": 20,
            "value": "sfo"
          }
        ]
      }]

I'm getting error : unable to make a request. error: Failed to validate sample at index 0. Start must be less than end.

I also slightly altered your integration test to reproduce the same error. I added below code to the TestIntegrationSamples test :

// samples test
	_, validateErr := c.ValidateSamples([]Sample{
		{
			Text: "I want to fly SFO",
			Entities: []SampleEntity{
				{
					Entity: "intent",
					Value:  "flight_request",
				},
				{
					Entity: "wit$location",
					Value:  "SFO",
					Start:  17,
					End:    20,
				},
			},
		},
	})

The added lines were just to make the test match the sample curl command in the docs : https://wit.ai/docs/http/20170307#post__samples_link

And as suspected the integration test now fails with :

=== RUN   TestIntegrationSamples
--- FAIL: TestIntegrationSamples (5.53s)
    integration_test.go:197: expected nil error, got unable to make a request. error: Failed to validate sample at index 0. Start must be less than end.

I believe this is because the struct def has int values for the start and end fields, but in this example where the intent doesn't need the text selection to be called out (like when you have a trait lookup strategy) so there is no value given for start and end, they are give the zero value for the type, which is 0.

The problem is the api receives :

[
  {
    "text": "I want to fly to sfo",
    "entities": [
      {
        "entity": "intent",
        "value": "flight_request",
        "start": 0,
        "end": 0,
        "role": "",
        "subentities": null,
      },
      {
        "entity": "wit$location",
        "value": "SFO",
        "start": 17,
        "end": 20,
        "role": "",
        "subentities": null,
      }
    ]
  }
]

and it responds with a 400 :

{
  "error": "Failed to validate sample at index 0. Start must be less than end.",
  "code": "bad-request"
}

If I hit the api outside of the library and replace the values of start and end with null or omit them completely then I get back a 200 and it works as expected.

Maybe I'm missing something here? I would really appreciate some help here. Thanks!

I don't know how to parse Entities from MessageResponse ?

Hello,

Sorry for a basic question but I wasted 5 days for that problem

// communicate with AI service
	result, err := witClient.Parse(&witai.MessageRequest{
		Query: textMessage,
	})

	if err != nil { // handle error

	}
	// we have `result` (witai.MessageResponse) here
	data := []byte(result.Entities) // cannot continue because error convert from interface{} to []byte

I cannot continue because error convert from interface{} to []byte.

I want to extract entities key to an array and entities content to an another.

Hope you can guide me how to extract that.

Thanks in advanced !

V2 is incorrectly packaged for Go modules

The latest release of this package is a major version (2.0.0) and thus requires a /v2 suffix on the module path per the Go modules docs. It is currently impossible to install the v2.0.0 release of this package via go get because of invalid packaging.

QueryEscape dont work with wit.ai api

Hey,

I dont know if this issue should be reported here or in the main wit.ai repo.

But with the golang client when i try to delete a value with a space in it for an intent e.g

wit.DeleteEntityValue("intent", "Au revoir")
The value is not deleted on wit.ai because of this : url.QueryEscape(value)

Standard QueryEscape call encodes a space with a "+" character.

Also this curl command dont work
curl -XDELETE 'https://api.wit.ai/entities/intent/values/Au+revoir?v=20170307'
But this one does
curl -XDELETE 'https://api.wit.ai/entities/intent/values/Au%20revoir?v=20170307'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.