Skip to content

Commit

Permalink
docs: fix url
Browse files Browse the repository at this point in the history
Signed-off-by: Han Xiao <[email protected]>
  • Loading branch information
hanxiao committed Oct 25, 2024
1 parent 99f4384 commit d65d0c3
Show file tree
Hide file tree
Showing 26 changed files with 143 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: "📚 Read docs"
url: https://docs.jina.ai/
url: https://jina.ai/serve/
about: Find your solution from our documenations
- name: "😊 Join us"
url: https://career.jina.ai
Expand Down
2 changes: 1 addition & 1 deletion .github/slack-pypi.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"accessory": {
"type": "image",
"image_url": "https://docs.jina.ai/_static/favicon.png",
"image_url": "https://jina.ai/serve/_static/favicon.png",
"alt_text": "cute cat"
}
},
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9569,7 +9569,7 @@ Jina is released on every Friday evening. The PyPi package and Docker Image will
- [[```4273af8d```](https://github.com/jina-ai/jina/commit/4273af8d46394f476423fd53c6bc4054050fd9cf)] __-__ remove hub-builder success (*Han Xiao*)
- [[```73457b17```](https://github.com/jina-ai/jina/commit/73457b17909b68c4415613ed8da78f2e6f9774a3)] __-__ hide my exec collide with other test (#2654) (*Joan Fontanals*)
- [[```e01ed315```](https://github.com/jina-ai/jina/commit/e01ed3152509b47a896d05d1d6d59ae41acb0515)] __-__ latency-tracking adapt new release (#2595) (*Alan Zhisheng Niu*)
- [[```7651bb44```](https://github.com/jina-ai/jina/commit/7651bb44e725002da65bda8a10d3b4477d692935)] __-__ replace docs2.jina.ai to docs.jina.ai (*Han Xiao*)
- [[```7651bb44```](https://github.com/jina-ai/jina/commit/7651bb44e725002da65bda8a10d3b4477d692935)] __-__ replace docs2.jina.ai to jina.ai/serve (*Han Xiao*)
- [[```26403122```](https://github.com/jina-ai/jina/commit/264031226563e6b84073c4b3a168fa5c1e2de1d0)] __-__ fix 404 page generation in ci (*Han Xiao*)

### 🍹 Other Improvements
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ Bonus: **Know when to break the rules**. Documentation writing is as much art as

[MyST](https://myst-parser.readthedocs.io/en/latest/) Elements Usage

1. Use the `{tab}` element to show multiple ways of doing one thing. [Example](https://docs.jina.ai/concepts/flow/basics/#start-and-stop)
2. Use the `{admonition}` boxes with care. We recommend restricting yourself to [Hint](https://docs.jina.ai/concepts/flow/basics/#create), [Caution](https://docs.jina.ai/concepts/gateway/customize-http-endpoints/#enable-graphql-endpoint) and [See Also](https://docs.jina.ai/concepts/gateway/customize-http-endpoints/#enable-graphql-endpoint).
3. Use `{dropdown}` to hide optional content, such as long code snippets or console output. [Example](https://docs.jina.ai/concepts/client/third-party-clients/#use-curl)
1. Use the `{tab}` element to show multiple ways of doing one thing. [Example](https://jina.ai/serve/concepts/flow/basics/#start-and-stop)
2. Use the `{admonition}` boxes with care. We recommend restricting yourself to [Hint](https://jina.ai/serve/concepts/flow/basics/#create), [Caution](https://jina.ai/serve/concepts/gateway/customize-http-endpoints/#enable-graphql-endpoint) and [See Also](https://jina.ai/serve/concepts/gateway/customize-http-endpoints/#enable-graphql-endpoint).
3. Use `{dropdown}` to hide optional content, such as long code snippets or console output. [Example](https://jina.ai/serve/concepts/client/third-party-clients/#use-curl)

### Building documentation on your local machine

Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/debianx.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.description="Build multimodal AI services via cloud native technologies" \
org.opencontainers.image.authors="[email protected]" \
org.opencontainers.image.url="https://github.com/jina-ai/jina" \
org.opencontainers.image.documentation="https://docs.jina.ai"
org.opencontainers.image.documentation="https://jina.ai/serve"

# constant, wont invalidate cache
ENV PIP_NO_CACHE_DIR=1 \
Expand Down
115 changes: 59 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Key advantages over FastAPI:
pip install jina
```

See guides for [Apple Silicon](https://docs.jina.ai/get-started/install/apple-silicon-m1-m2/) and [Windows](https://docs.jina.ai/get-started/install/windows/).
See guides for [Apple Silicon](https://jina.ai/serve/get-started/install/apple-silicon-m1-m2/) and [Windows](https://jina.ai/serve/get-started/install/windows/).

## Core Concepts

Expand All @@ -50,28 +50,31 @@ from jina import Executor, requests
from docarray import DocList, BaseDoc
from transformers import pipeline


class Prompt(BaseDoc):
text: str
text: str


class Generation(BaseDoc):
prompt: str
text: str
prompt: str
text: str


class StableLM(Executor):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.generator = pipeline(
'text-generation', model='stabilityai/stablelm-base-alpha-3b'
)

@requests
def generate(self, docs: DocList[Prompt], **kwargs) -> DocList[Generation]:
generations = DocList[Generation]()
prompts = docs.text
llm_outputs = self.generator(prompts)
for prompt, output in zip(prompts, llm_outputs):
generations.append(Generation(prompt=prompt, text=output))
return generations
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.generator = pipeline(
'text-generation', model='stabilityai/stablelm-base-alpha-3b'
)

@requests
def generate(self, docs: DocList[Prompt], **kwargs) -> DocList[Generation]:
generations = DocList[Generation]()
prompts = docs.text
llm_outputs = self.generator(prompts)
for prompt, output in zip(prompts, llm_outputs):
generations.append(Generation(prompt=prompt, text=output))
return generations
```

Deploy with Python or YAML:
Expand All @@ -83,7 +86,7 @@ from executor import StableLM
dep = Deployment(uses=StableLM, timeout_ready=-1, port=12345)

with dep:
dep.block()
dep.block()
```

```yaml
Expand Down Expand Up @@ -115,14 +118,10 @@ Chain services into a Flow:
```python
from jina import Flow

flow = (
Flow(port=12345)
.add(uses=StableLM)
.add(uses=TextToImage)
)
flow = Flow(port=12345).add(uses=StableLM).add(uses=TextToImage)

with flow:
flow.block()
flow.block()
```

## Scaling and Deployment
Expand Down Expand Up @@ -207,62 +206,66 @@ Enable token-by-token streaming for responsive LLM applications:
```python
from docarray import BaseDoc


class PromptDocument(BaseDoc):
prompt: str
max_tokens: int
prompt: str
max_tokens: int


class ModelOutputDocument(BaseDoc):
token_id: int
generated_text: str
token_id: int
generated_text: str
```

2. Initialize service:
```python
from transformers import GPT2Tokenizer, GPT2LMHeadModel


class TokenStreamingExecutor(Executor):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.model = GPT2LMHeadModel.from_pretrained('gpt2')
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.model = GPT2LMHeadModel.from_pretrained('gpt2')
```

3. Implement streaming:
```python
@requests(on='/stream')
async def task(self, doc: PromptDocument, **kwargs) -> ModelOutputDocument:
input = tokenizer(doc.prompt, return_tensors='pt')
input_len = input['input_ids'].shape[1]
for _ in range(doc.max_tokens):
output = self.model.generate(**input, max_new_tokens=1)
if output[0][-1] == tokenizer.eos_token_id:
break
yield ModelOutputDocument(
token_id=output[0][-1],
generated_text=tokenizer.decode(
output[0][input_len:], skip_special_tokens=True
),
)
input = {
'input_ids': output,
'attention_mask': torch.ones(1, len(output[0])),
}
input = tokenizer(doc.prompt, return_tensors='pt')
input_len = input['input_ids'].shape[1]
for _ in range(doc.max_tokens):
output = self.model.generate(**input, max_new_tokens=1)
if output[0][-1] == tokenizer.eos_token_id:
break
yield ModelOutputDocument(
token_id=output[0][-1],
generated_text=tokenizer.decode(
output[0][input_len:], skip_special_tokens=True
),
)
input = {
'input_ids': output,
'attention_mask': torch.ones(1, len(output[0])),
}
```

4. Serve and use:
```python
# Server
with Deployment(uses=TokenStreamingExecutor, port=12345, protocol='grpc') as dep:
dep.block()
dep.block()


# Client
async def main():
client = Client(port=12345, protocol='grpc', asyncio=True)
async for doc in client.stream_doc(
on='/stream',
inputs=PromptDocument(prompt='what is the capital of France ?', max_tokens=10),
return_type=ModelOutputDocument,
):
print(doc.generated_text)
client = Client(port=12345, protocol='grpc', asyncio=True)
async for doc in client.stream_doc(
on='/stream',
inputs=PromptDocument(prompt='what is the capital of France ?', max_tokens=10),
return_type=ModelOutputDocument,
):
print(doc.generated_text)
```

## Support
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ about:
license_family: Apache
license_file: LICENSE
summary: "Build multimodal AI services via cloud native technologies \xB7 Neural Search \xB7 Generative AI \xB7 Cloud Native"
doc_url: https://docs.jina.ai
doc_url: https://jina.ai/serve

extra:
recipe-maintainers:
Expand Down
8 changes: 4 additions & 4 deletions docs/concepts/jcloud/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ If shards/replicas are used, we will multiply credits further by the number of s

## Scale out Executors

On JCloud, demand-based autoscaling functionality is naturally offered thanks to the underlying Kubernetes architecture. This means that you can maintain [serverless](https://en.wikipedia.org/wiki/Serverless_computing) deployments in a cost-effective way with no headache of setting the [right number of replicas](https://docs.jina.ai/how-to/scale-out/#scale-out-your-executor) anymore!
On JCloud, demand-based autoscaling functionality is naturally offered thanks to the underlying Kubernetes architecture. This means that you can maintain [serverless](https://en.wikipedia.org/wiki/Serverless_computing) deployments in a cost-effective way with no headache of setting the [right number of replicas](https://jina.ai/serve/how-to/scale-out/#scale-out-your-executor) anymore!


### Autoscaling with `jinaai+serverless://`
Expand Down Expand Up @@ -266,8 +266,8 @@ The JCloud parameters `minAvailable` and `maxUnavailable` ensure that Executors

| Name | Default | Allowed | Description |
| :--------------- | :-----: | :---------------------------------------------------------------------------------------: | :------------------------------------------------------- |
| `minAvailable` | N/A | Lower than number of [replicas](https://docs.jina.ai/concepts/flow/scale-out/#scale-out) | Minimum number of replicas available during disruption |
| `maxUnavailable` | N/A | Lower than numbers of [replicas](https://docs.jina.ai/concepts/flow/scale-out/#scale-out) | Maximum number of replicas unavailable during disruption |
| `minAvailable` | N/A | Lower than number of [replicas](https://jina.ai/serve/concepts/flow/scale-out/#scale-out) | Minimum number of replicas available during disruption |
| `maxUnavailable` | N/A | Lower than numbers of [replicas](https://jina.ai/serve/concepts/flow/scale-out/#scale-out) | Maximum number of replicas unavailable during disruption |

```{code-block} yaml
---
Expand Down Expand Up @@ -459,7 +459,7 @@ Keys in `labels` have the following restrictions:

### Monitoring

To enable [tracing support](https://docs.jina.ai/cloud-nativeness/opentelemetry/) in Flows, you can pass `enable: true` argument in the Flow YAML. (Tracing support is not enabled by default in JCloud)
To enable [tracing support](https://jina.ai/serve/cloud-nativeness/opentelemetry/) in Flows, you can pass `enable: true` argument in the Flow YAML. (Tracing support is not enabled by default in JCloud)

```{code-block} yaml
---
Expand Down
14 changes: 7 additions & 7 deletions docs/concepts/jcloud/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
configuration
```

```{figure} https://docs.jina.ai/_images/jcloud-banner.png
```{figure} https://jina.ai/serve/_images/jcloud-banner.png
:width: 0 %
:scale: 0 %
```
Expand Down Expand Up @@ -50,13 +50,13 @@ For the rest of this section, we use `jc` or `jcloud`. But again they are interc

### Deploy

In Jina's idiom, a project is a [Flow](https://docs.jina.ai/concepts/orchestration/flow/), which represents an end-to-end task such as indexing, searching or recommending. In this document, we use "project" and "Flow" interchangeably.
In Jina's idiom, a project is a [Flow](https://jina.ai/serve/concepts/orchestration/flow/), which represents an end-to-end task such as indexing, searching or recommending. In this document, we use "project" and "Flow" interchangeably.

A Flow can have two types of file structure: a single YAML file or a project folder.

#### Single YAML file

A self-contained YAML file, consisting of all configuration at the [Flow](https://docs.jina.ai/concepts/orchestration/flow/)-level and [Executor](https://docs.jina.ai/concepts/serving/executor/)-level.
A self-contained YAML file, consisting of all configuration at the [Flow](https://jina.ai/serve/concepts/orchestration/flow/)-level and [Executor](https://jina.ai/serve/concepts/serving/executor/)-level.

> All Executors' `uses` must follow the format `jinaai+docker://<username>/MyExecutor` (from [Executor Hub](https://cloud.jina.ai)) to avoid any local file dependencies:
Expand Down Expand Up @@ -123,7 +123,7 @@ hello/
Where:

- `hello/` is your top-level project folder.
- `executor1` directory has all Executor related code/configuration. You can read the best practices for [file structures](https://docs.jina.ai/concepts/serving/executor/file-structure/). Multiple Executor directories can be created.
- `executor1` directory has all Executor related code/configuration. You can read the best practices for [file structures](https://jina.ai/serve/concepts/serving/executor/file-structure/). Multiple Executor directories can be created.
- `flow.yml` Your Flow YAML.
- `.env` All environment variables used during deployment.

Expand Down Expand Up @@ -374,7 +374,7 @@ jc secret create mysecret rich-husky-af14064067 --from-literal "{'env-name': 'se
```

```{tip}
You can optionally pass the `--update` flag to automatically update the Flow spec with the updated secret information. This flag will update the Flow which is hosted on the cloud. Finally, you can also optionally pass a Flow's yaml file path with `--path` to update the yaml file locally. Refer to [this](https://docs.jina.ai/cloud-nativeness/kubernetes/#deploy-flow-with-custom-environment-variables-and-secrets) section for more information.
You can optionally pass the `--update` flag to automatically update the Flow spec with the updated secret information. This flag will update the Flow which is hosted on the cloud. Finally, you can also optionally pass a Flow's yaml file path with `--path` to update the yaml file locally. Refer to [this](https://jina.ai/serve/cloud-nativeness/kubernetes/#deploy-flow-with-custom-environment-variables-and-secrets) section for more information.
```

```{caution}
Expand Down Expand Up @@ -419,7 +419,7 @@ jc secret update rich-husky-af14064067 mysecret --from-literal "{'env-name': 'se
```

```{tip}
You can optionally pass the `--update` flag to automatically update the Flow spec with the updated secret information. This flag will update the Flow which is hosted on the cloud. Finally, you can also optionally pass a Flow's yaml file path with `--path` to update the yaml file locally. Refer to [this](https://docs.jina.ai/cloud-nativeness/kubernetes/#deploy-flow-with-custom-environment-variables-and-secrets) section for more information.
You can optionally pass the `--update` flag to automatically update the Flow spec with the updated secret information. This flag will update the Flow which is hosted on the cloud. Finally, you can also optionally pass a Flow's yaml file path with `--path` to update the yaml file locally. Refer to [this](https://jina.ai/serve/cloud-nativeness/kubernetes/#deploy-flow-with-custom-environment-variables-and-secrets) section for more information.
```

```{caution}
Expand Down Expand Up @@ -498,7 +498,7 @@ jcloud:
#### Single YAML file
A self-contained YAML file, consisting of all configuration information at the [Deployment](https://docs.jina.ai/concepts/orchestration/deployment/)-level and [Executor](https://docs.jina.ai/concepts/serving/executor/)-level.
A self-contained YAML file, consisting of all configuration information at the [Deployment](https://jina.ai/serve/concepts/orchestration/deployment/)-level and [Executor](https://jina.ai/serve/concepts/serving/executor/)-level.
> A Deployment's `uses` parameter must follow the format `jinaai+docker://<username>/MyExecutor` (from [Executor Hub](https://cloud.jina.ai)) to avoid any local file dependencies:

Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/orchestration/flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Please follow the walkthrough and enjoy the free GPU/TPU!


```{tip}
Hosing services on Google Colab is not recommended if your server aims to be long-lived or permanent. It is often used for quick experiments, demonstrations or leveraging its free GPU/TPU. For stable, secure and free hosting of your Flow, check out [JCloud](https://docs.jina.ai/concepts/jcloud/).
Hosing services on Google Colab is not recommended if your server aims to be long-lived or permanent. It is often used for quick experiments, demonstrations or leveraging its free GPU/TPU. For stable, secure and free hosting of your Flow, check out [JCloud](https://jina.ai/serve/concepts/jcloud/).
```

## Export
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
html_theme = 'furo'

base_url = '/'
html_baseurl = 'https://docs.jina.ai'
html_baseurl = 'https://jina.ai/serve'
sitemap_url_scheme = '{link}'
sitemap_locales = [None]
sitemap_filename = "sitemap.xml"
Expand Down Expand Up @@ -167,8 +167,8 @@
linkcheck_retries = 2
linkcheck_anchors = False

ogp_site_url = 'https://docs.jina.ai/'
ogp_image = 'https://docs.jina.ai/_static/banner.png'
ogp_site_url = 'https://jina.ai/serve/'
ogp_image = 'https://jina.ai/serve/_static/banner.png'
ogp_use_first_image = True
ogp_description_length = 300
ogp_type = 'website'
Expand Down
2 changes: 1 addition & 1 deletion docs/html_extra/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
User-agent: *
sitemap: https://docs.jina.ai/sitemap.xml
sitemap: https://jina.ai/serve/sitemap.xml
2 changes: 1 addition & 1 deletion docs/tutorials/deploy-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ When you build a model or service in Jina-serve, it's always in the form of an E

In this example we need to install:

- The [Jina-serve framework](https://docs.jina.ai/) itself
- The [Jina-serve framework](https://jina.ai/serve/) itself
- The dependencies of the specific model we want to serve and deploy

```shell
Expand Down
Loading

0 comments on commit d65d0c3

Please sign in to comment.