Giter Site home page Giter Site logo

tutorial-knowledge-base's People

Contributors

selvamshan avatar tabergma 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

tutorial-knowledge-base's Issues

graql command not recognized + excepetion error 'action_query_entities'

After I train, rasa actions server, and rasa shell I get this error after a few lines of dialogue, I say hello, bot replies "I can give you some info......", I ask

"Can you give me information on my account please"

I get;

Encountered an exception while running action 'action_query_entities'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code

When first building the bot;

When I get to this command:

graql console --keyspace banking --file knowledge_base/schema.gql

I get no command found, but I can change the graql to grakn and it works?

I've installed grakn, run the server no problem, when I run; python knowledge_base/migrate.py

I get some errors, listed below

james:~/know# python knowledge_base/migrate.py
Loading data from [./knowledge_base/data/person] into Grakn ...
Traceback (most recent call last):
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grakn/service/Session/TransactionService.py", line 145, in send
response = next(self._response_iterator)
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grpc/_channel.py", line 364, in next
return self._next()
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grpc/_channel.py", line 358, in _next
raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "null. Please check server logs for the stack trace."
debug_error_string = "{"created":"@1563228826.113574006","description":"Error received from peer ipv4:127.0.0.1:48555","file":"src/core/lib/surface/call.cc","file_line":1052,"grpc_message":"null. Please check server logs for the stack trace.","grpc_status":2}"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "knowledge_base/migrate.py", line 201, in
build_banking_graph(inputs)
File "knowledge_base/migrate.py", line 10, in build_banking_graph
load_data_into_grakn(input, session)
File "knowledge_base/migrate.py", line 17, in load_data_into_grakn
with session.transaction(grakn.TxType.WRITE) as tx:
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grakn/init.py", line 69, in transaction
transaction_service = TransactionService(self.keyspace, tx_type, self.credentials, self._stub.transaction)
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grakn/service/Session/TransactionService.py", line 39, in init
self._communicator.send(open_req)
File "/root/miniconda3/envs/rasabot/lib/python3.6/site-packages/grakn/service/Session/TransactionService.py", line 149, in send
raise GraknError("Server/network error: {0}\n\n generated from request: {1}".format(e, request))
grakn.exception.GraknError.GraknError: Server/network error: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "null. Please check server logs for the stack trace."
debug_error_string = "{"created":"@1563228826.113574006","description":"Error received from peer ipv4:127.0.0.1:48555","file":"src/core/lib/surface/call.cc","file_line":1052,"grpc_message":"null. Please check server logs for the stack trace.","grpc_status":2}"

generated from request: open_req {
keyspace: "banking"
type: WRITE

Copy of the question from the forum

https://forum.rasa.com/t/are-there-any-existing-working-examples-of-rasa-2-grakn-out-there/40408

Are there any existing working examples of Rasa 2 + Grakn out there? Ideally - with Rasa Knowledge Actions (if they are stable enough).
I saw an old demo https://github.com/RasaHQ/tutorial-knowledge-base 1

The thing is that it will be perfect not to battle with migration to Rasa 2, new features of Knowledge Actions, and a fresh version of Grakn at the same time :slight_smile:

@tabergma maybe you know of some new projects in this area that can be scaffolded? Chat knowledge bases are a really interesting topic, especially with the rich structure of Grakn that got things like Workbase and GraMi

I saw several requests for update - so I hope it’s interesting not only for me. Will be happy to help where I can.
Thanks!

python migrate.py error

(rasa) PS C:\Users\siddharth.chauhan\AppData\Local\Continuum\anaconda3\envs\rasa\Projects\POC_knowledge_base\knowledge_base> python migrate.py
Loading from [./knowledge_base/data/person] into Grakn ...
Traceback (most recent call last):
File "migrate.py", line 201, in
build_banking_graph(inputs)
File "migrate.py", line 10, in build_banking_graph
load_data_into_grakn(input, session)
File "migrate.py", line 14, in load_data_into_grakn
items = parse_data_to_dictionaries(input)
File "migrate.py", line 165, in parse_data_to_dictionaries
with open(input["data_path"] + ".csv") as data: # 1
FileNotFoundError: [Errno 2] No such file or directory: './knowledge_base/data/person.csv'

Updating to typeDB

could you please update this tutorial to typeDB ?
Precisely how is get_concepts() replaceable in typeDB ?

'entity-type-mapping' not found

Hi @tabergma

I am having an issue with 'entity-type-mapping' too.
When I run rasa shell it gives me this error.

Your input -> hi Hi. I can give you some information about banks or I can give you some details about the accounts you own. What do you want to know? Your input -> i need my account details 2019-08-19 17:04:11 ERROR rasa.core.processor - Encountered an exception while running action 'action_query_attribute'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.

and in the action server the following error pops up.

Traceback (most recent call last):
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grakn/service/Session/TransactionService.py", line 156, in send
response = next(self._response_iterator)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grpc/_channel.py", line 364, in next
return self._next()
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grpc/_channel.py", line 358, in _next
raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "GraqlSemanticException-label 'entity-type-mapping' not found. Please check server logs for the stack trace."
debug_error_string = "{"created":"@1566214503.269706022","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"GraqlSemanticException-label 'entity-type-mapping' not found. Please check server logs for the stack trace.","grpc_status":3}"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/rasa_sdk/endpoint.py", line 59, in webhook
response = executor.run(action_call)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/rasa_sdk/executor.py", line 245, in run
events = action(dispatcher, tracker, domain)
File "/home/durashi/grakn-core-all-linux-1.5.7/chatbot/actions.py", line 245, in run
entity_type = get_entity_type(tracker)
File "/home/durashi/grakn-core-all-linux-1.5.7/chatbot/actions.py", line 44, in get_entity_type
return graph_database.map("entity-type-mapping", entity_type)
File "/home/durashi/grakn-core-all-linux-1.5.7/chatbot/graph_database.py", line 313, in map
f"match "
File "/home/durashi/grakn-core-all-linux-1.5.7/chatbot/graph_database.py", line 82, in _execute_attribute_query
result_iter = tx.query(query)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grakn/client.py", line 131, in query
return self._tx_service.query(query, infer)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grakn/service/Session/TransactionService.py", line 49, in query
response = self._communicator.send(request)
File "/home/durashi/python-virtual-environments/RasaEnv/lib/python3.7/site-packages/grakn/service/Session/TransactionService.py", line 160, in send
raise GraknError("Server/network error: {0}\n\n generated from request: {1}".format(e, request))
grakn.exception.GraknError.GraknError: Server/network error: <_Rendezvous of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "GraqlSemanticException-label 'entity-type-mapping' not found. Please check server logs for the stack trace."
debug_error_string = "{"created":"@1566214503.269706022","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"GraqlSemanticException-label 'entity-type-mapping' not found. Please check server logs for the stack trace.","grpc_status":3}"

generated from request: query_req {
query: "match $mapping isa entity-type-mapping, has mapping-key 'None', has mapping-value $v;get $v;"
}

127.0.0.1 - - [2019-08-19 17:05:03] "POST /webhook HTTP/1.1" 500 411 0.226519

Glad if could you help me with this error.
I am using python 3.7
rasa 1.1.4
grakn 1.5.7

And i did not do any changes in actions.py or graph_database.py or any other file in the repository.

Update lookuptables

I see reference to lookup lists are used in the training samples for query_kb intents.
Talking with reference to the banking demo,
does this imply every time an entry is made to the kb like a person / bank, it needs to be added in this list and model has to be retrained?

why do we have two schema files?

can someone explain why did we need another schema file (schema.gql, schema.py)?
and why does schema.py which has representation and keys, not have all attributes of an entity?
does that imply something or am i getting it wrong?

Cannot create Grakn Table

Hello @tabergma !

I just read your post about using the Knowledge Base for expanding Rasa's functionality, trust me its one of the Most Awesome integration idea I have ever read with Rasa!. The post was a wonderful article that certainly intrigued my attention towards using a Knowledge Base in my personal project.

However I was thrilled to learn and use Grakn for my pet project, I stumbled upon the below error:

Z:\tutorial-knowledge-base\knowledge_base>py migrate.py
Loading from [./data/person.csv] into Grakn ...
Traceback (most recent call last):
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grakn\service\Session\TransactionService.py", line 156, in send
    response = next(self._response_iterator)
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grpc\_channel.py", line 364, in __next__
    return self._next()
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grpc\_channel.py", line 358, in _next
    raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "GraqlSemanticException-gender doesn't have an 'isa', a 'sub' or an 'id'. Please check server logs for the stack trace."
        debug_error_string = "{"created":"@1564148583.887000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"GraqlSemanticException-gender doesn't have an 'isa', a 'sub' or an 'id'. Please check server logs for the stack trace.","grpc_status":3}"
>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "migrate.py", line 229, in <module>
    build_banking_graph(inputs)
  File "migrate.py", line 11, in build_banking_graph
    load_data_into_grakn(input, session)
  File "migrate.py", line 20, in load_data_into_grakn
    transaction.query(graql_insert_query)
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grakn\client.py", line 131, in query
    return self._tx_service.query(query, infer)
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grakn\service\Session\TransactionService.py", line 49, in query
    response = self._communicator.send(request)
  File "C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\grakn\service\Session\TransactionService.py", line 160, in send
    raise GraknError("Server/network error: {0}\n\n generated from request: {1}".format(e, request))
grakn.exception.GraknError.GraknError: Server/network error: <_Rendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "GraqlSemanticException-gender doesn't have an 'isa', a 'sub' or an 'id'. Please check server logs for the stack trace."
        debug_error_string = "{"created":"@1564148583.887000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"GraqlSemanticException-gender doesn't have an 'isa', a 'sub' or an 'id'. Please check server logs for the stack trace.","grpc_status":3}"
>

 generated from request: query_req {
  query: "insert $person isa person, has email \"[email protected]\", has first-name \"Catalina\", has last-name \"Sargent\", has city \"Frankfurt\", has phone-number \"621-620-0394\", has gender \"female\";"
}

Also, I checked the other issue posted by someone here; regarding almost the same thing and tried your suggestion of ensuring that Grakn is running OR not. However, my Grakn server is up and running at least what I make out of these lines:

Z:\grakn>grakn server start
====================================================================================================
      ________  _____     _______  __    __  __    __      _______  _______  _____     _______
     |   __   ||   _  \  |   _   ||  |  /  /|  \  |  |    |   _   ||   _   ||   _  \  |   ____|
     |  |  |__||  | |  | |  | |  ||  | /  / |   \ |  |    |  | |__||  | |  ||  | |  | |  |
     |  | ____ |  |_| /  |  |_|  ||  |/  /  |    \|  |    |  |     |  | |  ||  |_| /  |  |____
     |  ||_   ||   _  \  |   _   ||   _  \  |   _    |    |  |  __ |  | |  ||   _  \  |   ____|
     |  |__|  ||  | \  \ |  | |  ||  | \  \ |  | \   |    |  |_|  ||  |_|  ||  | \  \ |  |____
     |________||__|  \__\|__| |__||__|  \__\|__|  \__|    |_______||_______||__|  \__\|_______|

                                         THE KNOWLEDGE GRAPH
====================================================================================================
                                                                                      Version: 1.5.7
Storage is already running
Grakn Core Server is already running

Z:\grakn>

Hope you can guide me, please.
I'm currently running everything on a Windows 10 x64 machine.
Python: 3.7.3
Rasa: 1.1.4
Grakn: 1.5.7

Please let me know if you need any additional details.

Wish you heartiest all the best for future endeavor and please keep posting such wonderful and remarkable articles!! πŸ‘

Error running migrate.py script

Hi Tanja,

I checked the other issues instructions so I cleaned my grakn keyspace, created a new one but then the migration script gives me this error:

Loading from [./data/person] into Grakn ...
Inserted 20 items from [./data/person] into Grakn.
Loading from [./data/account] into Grakn ...
Traceback (most recent call last):
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grakn\service\Session\TransactionService.py", line 161, in send
    response = next(self._response_iterator)
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grpc\_channel.py", line 364, in __next__
    return self._next()
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grpc\_channel.py", line 358, in _next
    raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "syntax error at line 1:
insert $account isa account, has balance 267.69, has account-number "DE82444435329779109646", has account-type "credit", has opening-date 2019-01-16T10:49:31.641721;


   ^
mismatched input '721' expecting {'match', 'define', 'undefine', 'insert', 'compute'}. Please check server logs for the stack trace."
        debug_error_string = "{"created":"@1586159124.776000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"syntax error at line 1: \ninsert $account isa account, has balance 267.69, has account-number "DE82444435329779109646", has account-type "credit", has opening-date 2019-01-16T10:49:31.641721;\n

                                                         ^\nmismatched input '721' expecting {'match', 'define', 'undefine', 'insert', 'compute'}. Please check server logs for the stack trace.","grpc_status":2}"
>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "migrate.py", line 201, in <module>
    build_banking_graph(inputs)
  File "migrate.py", line 10, in build_banking_graph
    load_data_into_grakn(input, session)
  File "migrate.py", line 19, in load_data_into_grakn
    transaction.query(graql_insert_query)
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grakn\client.py", line 131, in query
    return self._tx_service.query(query, infer)
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grakn\service\Session\TransactionService.py", line 49, in query
    response = self._communicator.send(request)
  File "C:\Miniconda\envs\py37_default\lib\site-packages\grakn\service\Session\TransactionService.py", line 165, in send
    raise GraknError("Server/network error: {0}\n\n generated from request: {1}".format(e, request))
grakn.exception.GraknError.GraknError: Server/network error: <_Rendezvous of RPC that terminated with:
        status = StatusCode.UNKNOWN
        details = "syntax error at line 1:
insert $account isa account, has balance 267.69, has account-number "DE82444435329779109646", has account-type "credit", has opening-date 2019-01-16T10:49:31.641721;


   ^
mismatched input '721' expecting {'match', 'define', 'undefine', 'insert', 'compute'}. Please check server logs for the stack trace."
        debug_error_string = "{"created":"@1586159124.776000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"syntax error at line 1: \ninsert $account isa account, has balance 267.69, has account-number "DE82444435329779109646", has account-type "credit", has opening-date 2019-01-16T10:49:31.641721;\n

                                                         ^\nmismatched input '721' expecting {'match', 'define', 'undefine', 'insert', 'compute'}. Please check server logs for the stack trace.","grpc_status":2}"
>

 generated from request: query_req {
  query: "insert $account isa account, has balance 267.69, has account-number \"DE82444435329779109646\", has account-type \"credit\", has opening-date 2019-01-16T10:49:31.641721;"
}

migrating error

I got the error when I migrating could you help me soon please,

Loading from [./knowledge_base/data/person] into Grakn ...
Traceback (most recent call last):
File "E:\Projects\KB\tutorial-knowledge-base-master\knowledge_base\migrate.py", line 201, in
build_banking_graph(inputs)
File "E:\Projects\KB\tutorial-knowledge-base-master\knowledge_base\migrate.py", line 10, in build_banking_graph
load_data_into_grakn(input, session)
File "E:\Projects\KB\tutorial-knowledge-base-master\knowledge_base\migrate.py", line 14, in load_data_into_grakn
items = parse_data_to_dictionaries(input)
File "E:\Projects\KB\tutorial-knowledge-base-master\knowledge_base\migrate.py", line 165, in parse_data_to_dictionaries
with open(input["data_path"] + ".csv") as data: # 1
FileNotFoundError: [Errno 2] No such file or directory: './knowledge_base/data/person.csv'

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.