Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Update API README and example #76

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions skyagi-api/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# SkyAGI-API

SkyAGI-API is the web API endpoint of SkyAGI, which would allow users to interact with SkyAGI through web interface. With SkyAGI-API, anyone can convinienlty build interactive application that incorporates the emerging human-like capability from LLM.
SkyAGI-API is the websocket API endpoint of SkyAGI, which would allow users to interact with SkyAGI through API interface. With SkyAGI-API, anyone can convinienlty build interactive application that incorporates the emerging human-like capability from LLM.

SkyAGI-API is built on top of [langchain-serve](https://github.com/jina-ai/langchain-serve/tree/main) with websocket, and makes use of the [Human-in-the-loop](https://github.com/jina-ai/langchain-serve/tree/main/examples/websockets/hitl) capability to provide an interactive API experience just like running the SkyAGI application through python natively and locally.

## Endpoint

`/runskyagi`: the endpoint to start and run a SkyAGI session.
`/runskyagi`: the websocket endpoint to start and run a SkyAGI session.

### How the enpoint works

To initialize the SkyAGI session, a user needs to send the agent configurations in the json format.

Once the session is initiated, the endpoint will return the instructions of what user inputs are needed, and the web app can send the user inputs to the existing session through the established websocket and continue the SkyAGI session.
Once the websocket session is initiated, the endpoint will return the instructions of what user inputs are needed, and the web app can send the user inputs to the existing session through the established websocket and continue the SkyAGI session.

More information about how to use the `/runskyagi` endpoint can be found through the example app.

### How to use the endpoint

#### Use public cloud deployment (WIP)
#### Use public cloud deployment
The cloud SkyAGI websocket API is deployed at wss://langchain-558b0f2c14.wolf.jina.ai.

#### Use local deployment for testing

Expand All @@ -43,5 +44,5 @@ python skyagi-api-client.py -f <path-to-agent-config-json-files>
- [X] Return the error message with termination
- [X] Stream output back to client
- [X] Extend the client example to match the BigBangTheory from the example folder
- [ ] Deployment on Jina cloud: requires new SkyAGI python package release
- [X] Deployment on Jina cloud: requires new SkyAGI python package release
- [ ] Implement API auth on Jina cloud
3 changes: 2 additions & 1 deletion skyagi-api/example/skyagi-api-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ async def client(url: str, name: str, envs: Dict = {}):

asyncio.run(
client(
url="ws://localhost:8080",
url="ws://localhost:8080", # use local deployment
# url="wss://langchain-558b0f2c14.wolf.jina.ai", # use cloud deployment
name="runskyagi",
envs={
"OPENAI_API_KEY": os.environ["OPENAI_API_KEY"],
Expand Down