dialogflow / dialogflow-dotnet-client Goto Github PK
View Code? Open in Web Editor NEW.NET framework for Dialogflow
License: Apache License 2.0
.NET framework for Dialogflow
License: Apache License 2.0
Response.result does not contain the actionIncomplete field. It would be necessary for those who want to ensure a complete conversation before executing specific code.
Is it intentional that the SessionId of the AIDataService is overwriting the SessionId passed in on an AIRequest?
I spent a large chunk of time trying to figure out why my sessions weren't propagating across requests. This seems like somewhat confusing behavior to me. Thanks!
It seems that when returning a WebhookResponse
from a .NET Core API to Google DialogFlow for fulfilment that the response is mangled and incorrectly parsed in some way. Below is the simple controller I have servicing the fulfilment request:
// POST api/dialogflow
[HttpPost]
public IActionResult FulfillDialogFlowRequest([FromBody] WebhookRequest request)
{
var response = new WebhookResponse
{
FulfillmentText = "Hello from " + request.QueryResult.Intent.DisplayName
};
return Ok(response);
}
This should return the a blank WebhookResponse
with the fulfilment text: Hello from <intent name>
apon receiving any WebhookRequest
. However, DialogFlow receives the following fulfilment response:
Whereby, every character is seperated by a space. This does not occur when run locally with the sample webhook request and even copying the text removes the spaces displayed here.
The error message for this suggests a parsing error:
Webhook call failed. Error: Failed to parse webhook JSON response: Expect message object but got: \"笀∀昀甀氀昀椀氀氀洀攀渀琀吀攀砀琀∀㨀∀䠀攀氀氀漀 昀爀漀洀 吀攀猀琀嘀愀氀甀攀猀∀Ⰰ∀昀甀氀昀椀氀氀洀攀渀琀䴀攀猀猀愀最攀猀∀㨀嬀崀Ⰰ∀猀漀甀爀挀攀∀㨀∀∀Ⰰ∀瀀愀礀氀漀愀搀∀㨀渀甀氀氀Ⰰ∀漀甀琀瀀甀琀䌀漀渀琀攀砀琀猀∀㨀嬀崀Ⰰ∀昀漀氀氀漀眀甀瀀䔀瘀攀渀琀䤀渀瀀甀琀∀㨀渀甀氀氀紀\".
I've tried other methods to get this to work including returning the WebhookResponse
object as a string or using Newtonsoft JSON to format the object as a JSON. I couldn't find a issue like this on here and couldn't find any samples that demonstrated this use case.
For added context, the API is being hosted on Azure and other controllers function properly when deployed, also below is my .csproj
file to show versions of the various Nuget Packages etc.:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.4"/>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1"/>
<PackageReference Include="Google.Cloud.Dialogflow.V2" Version="1.0.0-beta02"/>
</ItemGroup>
</Project>
If any other information is required or other snippets from my code please don't hesitate to ask and I will reply as soon as I can!
This issue was automatically created by Allstar.
Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code
Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.
Remediation Steps
To remediate, remove the generated executable artifacts from the repository.
Artifacts Found
Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.
Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar
This issue will auto resolve when the policy is in compliance.
Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.
Hi,
I'd like to ask why there's no model for the webhook request response. I mean the class that map the json with fields "speech", "displayText", "contextsOut" and so on.
Thanks!
I was wondering if there is ever going to be a .NET Portable version as I want to make a DLL containing all my apiai code, then have a class name Actions
that contains all actions related to my chatbot,
So in theory a user could import this DLL and make a class inheriting the Actions
class and override a specific action so their code runs when apiai returns an action
I'd like to use the Dialogflow API v2 in my .net environment.
Are there any plans for a v2 of this sdk yet?
SupportedLanguage supLang = ApiAiSDK.SupportedLanguage.FromLanguageTag(Language);
supLang is always equal to "en" even if Language is "French".
i'm using version 1.6.5 of ApiAiSDK
below "SupportedLanguage" class (from metadata):
/********/
namespace ApiAiSDK
{
public class SupportedLanguage
{
public static readonly SupportedLanguage English;
public static readonly SupportedLanguage Russian;
public static readonly SupportedLanguage German;
public static readonly SupportedLanguage Portuguese;
public static readonly SupportedLanguage PortugueseBrazil;
public static readonly SupportedLanguage Spanish;
public static readonly SupportedLanguage French;
public static readonly SupportedLanguage Italian;
public static readonly SupportedLanguage Dutch;
public static readonly SupportedLanguage Japanese;
public static readonly SupportedLanguage ChineseChina;
public static readonly SupportedLanguage ChineseHongKong;
public static readonly SupportedLanguage ChineseTaiwan;
public readonly string code;
public static SupportedLanguage FromLanguageTag(string languageTag);
}
}
/********/
How can I fix it?
Many thanks in advance.
Best regards
Andrea
Hello,
My name is Bruno Brandes and I love learning about api.ai.
I developed Alice.
Alice is a insurance travel BOT using api.ai, Microsoft Bot Framework and Messaging Hub2.
My Agent in api.ai is configured to use webhook but when receives a call in my endpoint, I cant relate the request with my session because query response dosent contain sessionId passed query request 😦
My alternative for this problem was create a intents and context in api.ai for receiving text with "create session @sys.any:sessionId" and force my application call the api.ai in first user contact then finaly receiving query response with parameter sessionId.
I wonder...
Contains another way to do this?
Hello my friends,
I'm trying to create text variants using the /intents API resource mentioned here: https://dialogflow.com/docs/reference/agent/intents
However, it seems that there is not a way to do such thing. if I send the JSON as:
"responses": [
{
"messages": [
{
"speech": "Okay response variant 01",
"type": 0
},
{
"speech": "Okay response variant 02",
"type": 0
}
],
it creates 2 full response text messages instead of a text variant, do you know what I could be missing on the JSON to create the responses as text variant?
Do you have any idea?
Thanks in advance.
@xVir The unit test are currently broken and the Travis Build Server is apparently not running.
ApiAiSDK.AIServiceException : Invalid request content type, expecting "multipart/form-data" or "application/json; charset=utf-8.
----> ApiAiSDK.AIServiceException : Invalid request content type, expecting "multipart/form-data" or "application/json; charset=utf-8.
at ApiAiSDK.AIDataService.VoiceRequest(Stream voiceStream, RequestExtras requestExtras) in C:\Users\movgp\Documents\ApiAi\ApiAiSDK\AIDataService.cs:line 166
at ApiAiSDK.ApiAi.VoiceRequest(Stream voiceStream, RequestExtras requestExtras) in C:\Users\movgp\Documents\ApiAi\ApiAiSDK\ApiAi.cs:line 75
at ApiAiSDK.Tests.ApiAiTest.VoiceRequestTest() in C:\Users\movgp\Documents\ApiAi\ApiAiSDK.Tests\ApiAiTest.cs:line 71
--AIServiceException
at ApiAiSDK.AIDataService.CheckForErrors(AIResponse aiResponse) in C:\Users\movgp\Documents\ApiAi\ApiAiSDK\AIDataService.cs:line 194
at ApiAiSDK.AIDataService.VoiceRequest(Stream voiceStream, RequestExtras requestExtras) in C:\Users\movgp\Documents\ApiAi\ApiAiSDK\AIDataService.cs:line 159
I think it should be easy to support .net core since from nuget, the only dependency for this library seems to be Json.Net, which also available in .net core.
Can you please make that happen?
Hi
Dates received from api.ai REST API is different from date received from API.AI DotNet SDK
I have a bot and am passing dates as below
Passed 2 dates as below format
01/12/2017 - result from DotNet SDK is 12-01-2017 while from Console JSOn it is 01-12-2017
15/12/2017 - result from DotNet SDK is 15-12-2017 while from Console JSOn it is 15-12-2017
Visual Studio 2015 Project
Screenshots attached for the watch in dotnet sdk and console JSON for same inputs
Regards
Hi.
How i can send a Event Request to api.ai?
To, for example, display a welcome message to the user?
Tks!
In a case when developer creates composite entity, we get the next structure of answer's context :
"contexts": [
{
"name": "spec_statistics_out_context",
"parameters": {
"option.original": "best devices",
"option": {
"count_stat": {
"what": "TopDevices",
"what.original": "devices"
},
"count_stat.original": "best devices"
}
},
"lifespan": 1
}
],
The problem is in "parameters field". In SDK in Context class field 'parameter' has type Dictionary<string, string>. But as you can see in example, we can retrieve pair <string, object> as well.
here we get an error from Newtonsoft.JSON lib and can't get response on user request.
Edit1: the error only occured, when Intent with such composit entity also has other contexts (out\in)
I created a chatbot with de API.ai console.
I also created a dotnet project where I implemented api.ai with the SDK.
The bot answers the questions, but it doesn't remember the session.
When the client asks something and the bot response with a question for more information. The client gives the information, but then de bot doesn't know where it is about. But in the console it does work.
Example:
Client: I want to cook diner.
Bot: What ingredients do you want to use?
Client: Beef and brocolli.
Bot: I don't know what you mean.
Can anybody help my? How can I create something like a session?
Hey,
I am trying to install "ApiAiSdk" nugget in my xamarin forms project for .Net Standard 2.0,Android and ios. but i am unable to install it.
Please give me suggestion.
Thanks.
Ankush
Do you plan to support Thai language?
Do you plan to support Microsoft Bot Framework?
Hi!
There's a problem when the class AIDataService try to perform a deserialization to an AIResponse, because AIResponse contains a Result, and the Result has a "parameters" field typed of Dictionary<string,object>. So, when the parameter is list, it dictionary should be: Dictionary<string, List>, in order to deserializate the json correctly.
Can you give an example of a fulfilment using the SDK including ability to add headers.
Test for Voice Requst is failing
It seems that this SDK is not being changed to be up to date with the current Dialogflow API. For example, how can I trigger a Dialogflow event with this SDK?
Does anyone know if there is a Swagger doc for the current Dialogflow API?
As explained above, no xml with the dll in Nuget
Hi guys,
It seems that after using either the BatchUpdateIntentsAsync or UpdateIntentAsync calls from the client api results in the intent losing the state of whether this intent is the end of the conversation.
Note: The used intent name has not been changed at all.
Is there anyway to read the state of this flag or force an update of this flag?
Thanks
hi everyone,
I added the apiai dll file to the references in a console .net core application. when I create an object from ApiAi class I can use every method except TextRequest. It doesn't seem to exist in that class. what should I do ?
Hello
I´m trying to get and save the sessionId from Dialogflow, but all sources and tutorials didn´t get me to a working prototype.
Does anybody ever needed to get the sessionId? Or does anybody have some resources to help me out on this one?
Thanks
According to the /query documentation, sessionId
is required and enables us to link messages together into a single session - is there a reason why the SessionId property is marked as internal?
Shouldn't a consumer be able to set this to some conversation specific id to link queries and contexts together?
googleapis/google-cloud-dotnet#3903
googleapis/google-cloud-dotnet#3903 (comment)
Any help would be appreciated.
Thanks.
Hi,
i am calling VoiceRequestTest and passing one of audio provided in sample but ti gives me error.
i am developing window form application.
error as below
{
"id": "e5cca5a5-53ba-4c1c-af16-2866096938b5",
"timestamp": "2018-08-08T00:46:08.31Z",
"lang": "en",
"status": {
"code": 400,
"errorType": "bad_request",
"errorDetails": "Invalid request content type, expecting "multipart/form-data" or "application/json; charset\u003dutf-8."
}
}
There is no way to set the followupEvent in the response.
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.