ci: trigger workflow during release

This commit is contained in:
Deepankar Mahapatro 2023-05-17 10:24:19 +05:30
commit a2e5fab637
5 changed files with 55 additions and 10 deletions

View file

@ -51,7 +51,7 @@ jobs:
- name: Trigger build and push on langchain-serve
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.DEEPANKAR_GITHUB_TOKEN }} # TODO: repo authors need to create a PAT and add it to secrets
token: ${{ secrets.SERVE_GITHUB_TOKEN }}
repository: jina-ai/langchain-serve
event-type: langflow-push
client-payload: '{"push_token": "${{ secrets.LCSERVE_PUSH_TOKEN }}", "branch": "dev"}' # TODO: repo authors need to store `LCSERVE_PUSH_TOKEN` in secrets
client-payload: '{"push_token": "${{ secrets.LCSERVE_PUSH_TOKEN }}", "branch": "dev"}'

View file

@ -50,10 +50,16 @@ Alternatively, click the **"Open in Cloud Shell"** button below to launch Google
Langflow integrates with langchain-serve to provide a one-command deployment to Jina AI Cloud.
Start by installing `langchain-serve` with `pip install -U langchain-serve`. Then, run:
Start by installing `langchain-serve` with
```bash
langflow jcloud
pip install -U langchain-serve
```
Then, run:
```bash
langflow --jcloud
```
```text
@ -95,7 +101,43 @@ langflow jcloud
</details>
> Read more about customization, cost, and management of Langflow on Jina AI Cloud in the **[langchain-serve](https://github.com/jina-ai/langchain-serve)** repository.
#### API Usage
You can use Langflow directly on your browser, or use the API endpoints on Jina AI Cloud to interact with the server.
<details>
<summary>Show API usage (with python)</summary>
```python
import json
import requests
FLOW_PATH = "Time_traveller.json"
# HOST = 'http://localhost:7860'
HOST = 'https://langflow-f1ed20e309.wolf.jina.ai'
API_URL = f'{HOST}/predict'
def predict(message):
with open(FLOW_PATH, "r") as f:
json_data = json.load(f)
payload = {'exported_flow': json_data, 'message': message}
response = requests.post(API_URL, json=payload)
return response.json()
predict('Take me to 1920s Bangalore')
```
```json
{
"result": "Great choice! Bangalore in the 1920s was a vibrant city with a rich cultural and political scene. Here are some suggestions for things to see and do:\n\n1. Visit the Bangalore Palace - built in 1887, this stunning palace is a perfect example of Tudor-style architecture. It was home to the Maharaja of Mysore and is now open to the public.\n\n2. Attend a performance at the Ravindra Kalakshetra - this cultural center was built in the 1920s and is still a popular venue for music and dance performances.\n\n3. Explore the neighborhoods of Basavanagudi and Malleswaram - both of these areas have retained much of their old-world charm and are great places to walk around and soak up the atmosphere.\n\n4. Check out the Bangalore Club - founded in 1868, this exclusive social club was a favorite haunt of the British expat community in the 1920s.\n\n5. Attend a meeting of the Indian National Congress - founded in 1885, the INC was a major force in the Indian independence movement and held many meetings and rallies in Bangalore in the 1920s.\n\nHope you enjoy your trip to 1920s Bangalore!"
}
```
</details>
> Read more about resource customization, cost, and management of Langflow apps on Jina AI Cloud in the **[langchain-serve](https://github.com/jina-ai/langchain-serve)** repository.
## 🎨 Creating Flows

4
poetry.lock generated
View file

@ -5768,9 +5768,9 @@ cffi = {version = ">=1.11", markers = "platform_python_implementation == \"PyPy\
cffi = ["cffi (>=1.11)"]
[extras]
production = ["langchain-serve"]
deploy = ["langchain-serve"]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
content-hash = "a6fa5f8b36994c9b7dfa3de4979099f2e76cb534697823b49a949c661efa3fba"
content-hash = "bca5ed5cd32c5ad8d80faf99e9d988703202dd52001d2cbadaf61968a7cdebcc"

View file

@ -68,7 +68,7 @@ types-pillow = "^9.5.0.2"
[tool.poetry.extras]
production = ["langchain-serve"]
deploy = ["langchain-serve"]
[tool.ruff]
line-length = 120

View file

@ -33,11 +33,15 @@ def serve(
config: str = typer.Option("config.yaml", help="Path to the configuration file."),
log_level: str = typer.Option("info", help="Logging level."),
log_file: Path = typer.Option("logs/langflow.log", help="Path to the log file."),
jcloud: bool = typer.Option(False, help="Deploy on Jina AI Cloud"),
):
"""
Run the Langflow server.
"""
if jcloud:
return serve_on_jcloud()
configure(log_level=log_level, log_file=log_file)
update_settings(config)
app = create_app()
@ -69,8 +73,7 @@ def serve(
LangflowApplication(app, options).run()
@app.command()
def jcloud():
def serve_on_jcloud():
"""
Deploy Langflow server on Jina AI Cloud
"""