Rasa: Missing Python API guide in Rasa 1.0 docs

Created on 27 May 2019  路  19Comments  路  Source: RasaHQ/rasa

Rasa version: Rasa 1.0

Python version: 3.6

Operating system (windows, osx, ...): Linux

Issue: A general Python API guide is missing in Rasa 1.0 docs
I think many developper who have used Rasa since its very creation have developed their own scripts for training, testing and running models using the Python API guide, such as the old ones http://legacy-docs.rasa.com/docs/nlu/python/. However, this page seems to have been removed. The transition from rasa nlu+core to rasa 1.0 which broke some compabilities makes things even harder, as the migration guide (http://rasa.com/docs/rasa/migration-guide/) doesn't explain all, for example, Agent.train (https://forum.rasa.com/t/call-agent-train-occurs-typeerror-coroutine-object-is-not-iterable/10135).

If one can have a simple Python API guide, which describes examples of training a nlu model, running a nlu with a given model, training a core model, running a chatbot with a nlu model and a core model (or directly a rasa model), that could be super.

Content of configuration file (config.yml): Not Relevant
Content of domain file (domain.yml) (if used & relevant): Not Relevant

type

Most helpful comment

Any updates on publishing an API Guide? It would make the developer community an order of magnitude faster and successful with on-boarding to Rasa. I spend my days reading Rasa code to infer how to use the APIs, which is an incredible waste of time, and extremely error prone and unproductive. A single API Guide would lift the entire Rasa development community, which is seriously needed as that community is currently exploding.

All 19 comments

Yes very good point, we should add some more examples like this one https://rasa.com/docs/rasa/api/agent/#rasa.core.agent.Agent.handle_text to the function docs.

Dear @tmbo . I'd like to see more examples like before. I had seen this example you mentioned: https://rasa.com/docs/rasa/api/agent/#rasa.core.agent.Agent.handle_text. Sorry to say I found it very difficult to understand. First, why is RasaNLUInterpreter imported; second, because of asyncio, a normal user cannot run this code easily.

More generally speaking, because of asyncio, many scripts in rasa.core which worked before (as examples in the previous docs) don't work anymore. Like the example I cited previously: Agent.train (https://forum.rasa.com/t/call-agent-train-occurs-typeerror-coroutine-object-is-not-iterable/10135), many ppl are still waiting for solutions.

We are on it. But in the meantime you should just wrap any functions that are async with an event loop, e.g.

loop = asyncio.get_event_loop()
training_data = loop.run_until_complete(agent.load_data(training_data_file))
agent.train(training_data)

Thank you @tmbo for your quick reply and your understanding. In terms of asyncio, yes. I advise to mention "asyncio" in miragtion guide or somewhere else, as I could only find which functions are now using async by viewing source code in rasa.core.

PS: I also found that asyncio in python3.7+ can make use of new functions (asyncio.run) that didn't exist for python3.6-.

I am also looking forward to the Python API guide. Just a heads up, the links here: http://legacy-docs.rasa.com/docs/ all point to the new Rasa 1.0 docs, not the legacy Python docs. Additionally, the links to documentation for rasa-nlu on PyPi are all redirecting to the root directory of the new documentation: https://pypi.org/project/rasa-nlu/.
Please keep us up to date when the Python API docs for Rasa 1.0 are ready!

Just a heads up, the links here: http://legacy-docs.rasa.com/docs/ all point to the new Rasa 1.0 docs, not the legacy Python docs.

Thanks for catching this! I've already implemented these fixes, they just haven't been built yet 馃檪should hopefully be live by the end of the week

@amn41 is this fixed now?

I too need this. I think my issue will probably be resolved with this. Can you let us know the timeline for this?

I have no exact timeline yet, but we'll be working on a bunch of additions to the docs in the next few months

Same thoughts here. I've been "hacking" away at the code to try and get Rasa to do what I need without using the CLI. It's been frustrating at times, but I'm not too annoyed because I'm learning a whole lot.

Same problem here! I have been trying to update from 0.14, but with the amount of breakage and non availability of python api documentation it is not remotely possible.

Also, a general question to the audience - We should be able to use Rasa 1.2+ in the same way as before ? My workflow has been train using python api, and inference of intent+entity through the trained model. Is it mandatory to run Rasa as a separate HTTP endpoint, or is it possible to have my code (flask application) run standalone as a single python instance like before with rasa 1.2+ ?

Thanks,
Thusitha

you don't need to run a server, it is still possible to load and use models directly from code. e.g. here is an example in the agent interface documentation: https://rasa.com/docs/rasa/api/agent/#rasa.core.agent.Agent.handle_text

Any updates on publishing an API Guide? It would make the developer community an order of magnitude faster and successful with on-boarding to Rasa. I spend my days reading Rasa code to infer how to use the APIs, which is an incredible waste of time, and extremely error prone and unproductive. A single API Guide would lift the entire Rasa development community, which is seriously needed as that community is currently exploding.

exploding? 馃槃 I agree this is very important, and it is among the docs issues we're working on tackling. Thanks for letting us know

I was looking for a DialogFlow alternative, but I make extensive use of their APIs. I had been concerned that there will be a decent amount of development time required to get to the state that I currently have DialogFlow in. After looking for Python documentation, that concern grew exponentially.

As @joeytrevino said, it seems like the primary way to deduce API calls is to look at other existing code, which is very inefficient. Has there been any movement on the API docs?

Any update on the docs?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hello team, is there an updated guide for Python?
And do you need assistance creating one if it isn't ready yet?

Was this page helpful?
0 / 5 - 0 ratings