Skip to content

Commit 2fb4865

Browse files
Samuel PSamuel P
authored andcommitted
Update docs to be better.
1 parent 6f08e57 commit 2fb4865

File tree

10 files changed

+289
-83
lines changed

10 files changed

+289
-83
lines changed

content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ curl https://app.tryhelix.ai/api/v1/sessions \
4646

4747
Get your API key from [Account](https://app.tryhelix.ai/account) page in the app.
4848

49-
[Full API reference]({{< ref "/helix/api.md" >}})
49+
[Full API reference]({{< ref "/helix/api-reference/_index.md" >}})
5050
{{% /index/cta-right %}}
5151
{{< /index/cta >}}

content/helix/api-reference/_index.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: API Reference
3+
weight: 8
4+
prev: /helix/private-deployment/_index.md
5+
aliases:
6+
- /docs/api
7+
---
8+
9+
The REST API is the fundamental fabric of Helix. All operations and communications between components, and external user commands are REST API calls that the Control Plane handles.For general background information, get familiar with the [Helix architecture](https://docs.helix.ml/helix/getting-started/architecture/) and the components involved.
10+
11+
With Helix's API, you can access a wide range of features, including natural language processing, machine learning models, data analysis, and more. Here's how to get started:
12+
13+
1. **API Key and Authentication**: First, sign up on [Helix](https://app.tryhelix.ai/) and obtain your API key from the [Account section](https://app.tryhelix.ai/account). The API key is required to authenticate your requests and ensure secure communication between your application and Helix.
14+
15+
All API requests should include your API key in an Authorization HTTP header as follows:
16+
17+
```
18+
Authorization: Bearer Helix_API_KEY
19+
```
20+
21+
2. **Making Requests**: Use HTTP methods like GET, POST, PUT, and DELETE to interact with the API. Depending on the feature you're utilizing, you may need to send JSON data, files, or other inputs in your requests.
22+
23+
3. **Handling Responses**: The API will return responses in JSON format, containing the results of your request, status codes, and any relevant error messages. Properly handle these responses in your application to ensure smooth operation.
24+
25+
26+
## More Information
27+
28+
Get your API key from [Account](https://app.tryhelix.ai/account) page in the app.
29+
30+
For the rest of the endpoints, see the generated [OpenAPI Spec](https://github.com/helixml/helix/blob/main/api/pkg/server/swagger.yaml) or the [code](https://github.com/helixml/helix/blob/main/api/pkg/server/server.go#L81-L215).
31+
32+
Please encourage us to write more on this on [Discord](https://discord.gg/VJftd844GE)!
33+
34+
<!--more-->
35+
36+
{{< default-section-cards-list >}}

content/helix/api-reference/apps.md

Whitespace-only changes.

content/helix/api-reference/openai.md

Whitespace-only changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Sessions
3+
weight: 1
4+
prev: /helix/api-reference/_index.md
5+
aliases:
6+
- /docs/sessions
7+
---
8+
9+
An Helix session object is a structured data entity used to represent and manage the state, context, and interactions during a conversation between a user and an the Helix system. This object typically contains information necessary to maintain the continuity of the dialogue, track user inputs, and store any relevant context or variables that might influence the responses. All sessions are identified by a unique session ID.
10+
11+
## Explore Session metadata
12+
13+
Create a chat session on [Helix](https://app.tryhelix.ai/session/ses_01j56vxhjn6qh23hecxdan147a) and grab the session id from the browser URL.
14+
15+
```shell
16+
curl 'https://app.tryhelix.ai/api/v1/sessions/<SESSION_ID>' \
17+
-H 'Authorization: Bearer <YOUR_API_KEY>' \
18+
--compressed
19+
```
20+
21+
The response will show all of details of a session.
22+
23+
```json
24+
{
25+
"id": "ses_testnan1brx876npc23",
26+
"name": "magical-chat-815",
27+
"parent_session": "",
28+
"parent_app": "",
29+
"config": {
30+
...
31+
},
32+
"mode": "inference",
33+
"type": "image",
34+
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
35+
"lora_dir": "",
36+
"interactions": [
37+
{
38+
...
39+
},
40+
]
41+
}
42+
43+
```
44+
45+
The [Helix Open API Spec](https://github.com/helixml/helix/blob/main/api/pkg/server/swagger.yaml) details the session request and response objects.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Chat Session
3+
weight: 1
4+
prev: /helix/api-reference/sessions/_index.md
5+
aliases:
6+
- /docs/chat-session
7+
---
8+
9+
## Create an inference session
10+
11+
An *inference session* is when a trained machine learning model is used to make predictions or decisions based on new data. Unlike training, which involves learning from data, inference applies the learned model to real-world inputs to produce outputs. Helix offers various [AI models](https://docs.helix.ml/helix/models/models/) which can be used for inference.
12+
13+
##### Example Request and Response
14+
15+
```shell
16+
curl https://app.tryhelix.ai/api/v1/sessions \
17+
-H 'Authorization: Bearer <YOUR_API_KEY>'
18+
-d "input=yo&mode=inference&type=text"
19+
```
20+
21+
will respond with
22+
23+
```json
24+
{
25+
"created": 1723155364,
26+
"object": "chat.completion",
27+
"id": "ses_01a4t10cysc825d3k037tyh7ap",
28+
"model": "llama3:instruct",
29+
"choices": [
30+
{
31+
"index": 0,
32+
"finish_reason": "stop",
33+
"message": {
34+
"role": "assistant",
35+
"content": "The Faroe Islands (Føroyar in Faroese) are a North Atlantic archipelago located halfway between Iceland and Norway."
36+
}
37+
}
38+
],
39+
"usage": {
40+
"prompt_tokens": 0,
41+
"completion_tokens": 168,
42+
"total_tokens": 168
43+
}
44+
}
45+
```
46+
47+
##### HTTP Request
48+
49+
```
50+
POST https://app.tryhelix.ai/api/v1/sessions/chat
51+
```
52+
53+
##### Parameters
54+
Request body with the message and model to start chat completion.
55+
56+
```json
57+
{
58+
"app_id": "string",
59+
"assistant_id": "string",
60+
"legacy": true,
61+
"lora_dir": "string",
62+
"lora_id": "string",
63+
"messages": [
64+
{
65+
"content": {
66+
"content_type": "text",
67+
"parts": [
68+
"string"
69+
]
70+
},
71+
"created_at": "string",
72+
"id": "string",
73+
"role": "system",
74+
"state": "",
75+
"updated_at": "string"
76+
}
77+
],
78+
"model": "string",
79+
"rag_source_id": "string",
80+
"session_id": "string",
81+
"stream": true,
82+
"system": "string",
83+
"tools": [
84+
"string"
85+
],
86+
"type": "text"
87+
}
88+
```
89+
90+
`"type":"image|chat"`
91+
92+
Switching over the `"type":"image"` will start a session with model `stabilityai/stable-diffusion-xl-base-1.0` that generates an image.
93+
Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
11
---
2-
title: API Reference
3-
weight: 8
4-
prev: /helix/private-deployment/_index.md
2+
title: Fine Tuning Session
3+
weight: 1
4+
prev: /helix/api-reference/sessions/chat-sessions.md
55
aliases:
6-
- /docs/api
6+
- /docs/fine-tuning-session
77
---
88

9-
## Easy to use API
109

11-
Create a new chat session:
12-
13-
```shell
14-
curl https://app.tryhelix.ai/api/v1/sessions \
15-
-H 'Authorization: Bearer <YOUR_API_KEY>'
16-
-d "input=yo&mode=inference&type=text"
17-
```
18-
19-
Generate an image:
20-
21-
```shell
22-
curl https://app.tryhelix.ai/api/v1/sessions \
23-
-H 'Authorization: Bearer <YOUR_API_KEY>'
24-
-d "input=flying fish&mode=inference&type=image"
25-
```
26-
27-
### Create a Text Fine-Tuning Session
10+
## Create a Text Fine-Tuning Session
2811

2912
First create a file that will be used to upload the text data. It should be in [`multipart/form-data` format](https://www.rfc-editor.org/rfc/rfc7578). The form data keys `mode` and `type` are required to distinguish that this is a text fine-tuning session.
3013

@@ -55,14 +38,14 @@ EOL
5538
Now `POST` that file to Helix to create a new fine-tuning session.
5639

5740
```shell
58-
curl 'https://app.tryhelix.ai/api/v1/sessions' \
41+
curl 'https://app.tryhelix.ai/api/v1/sessions/learn' \
5942
-H 'Authorization: Bearer <YOUR_API_KEY>' \
6043
-H 'Content-Type: multipart/form-data; boundary=---BOUNDARY' \
6144
--data-binary @session-data.form \
6245
--compressed
6346
```
64-
65-
#### Check on the Status of a Fine-Tune Session
47+
.
48+
## Check on the Status of a Fine-Tune Session
6649

6750
First grab the ID of your session from the `id` field of the output of the create session API. Then run:
6851

@@ -75,11 +58,3 @@ curl 'https://app.tryhelix.ai/api/v1/sessions/<SESSION_ID>' \
7558
The response will show all of the generated QA pairs for the fine-tune session as well as the status of the session.
7659

7760
Look at the `interactions` key to find the current state.
78-
79-
## More Information
80-
81-
Get your API key from [Account](https://app.tryhelix.ai/account) page in the app.
82-
83-
For the rest of the endpoints, see the [code](https://github.com/helixml/helix/blob/main/api/pkg/server/server.go#L81-L215).
84-
85-
Please encourage us to write more on this on [Discord](https://discord.gg/VJftd844GE)!

hugo_stats.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"h2",
2121
"h3",
2222
"h4",
23+
"h5",
2324
"head",
2425
"html",
2526
"iframe",
@@ -401,6 +402,7 @@
401402
"ltr:hx-ml-3",
402403
"ltr:hx-ml-auto",
403404
"ltr:hx-mr-auto",
405+
"ltr:hx-pl-12",
404406
"ltr:hx-pl-3",
405407
"ltr:hx-pl-4",
406408
"ltr:hx-pl-8",
@@ -476,6 +478,7 @@
476478
"rtl:hx-mr-3",
477479
"rtl:hx-mr-auto",
478480
"rtl:hx-pl-4",
481+
"rtl:hx-pr-12",
479482
"rtl:hx-pr-3",
480483
"rtl:hx-pr-4",
481484
"rtl:hx-pr-8",
@@ -561,6 +564,7 @@
561564
"business-prompts",
562565
"can-i-integrate-my-models-with-my-own-apps-or-business-apps-once-ive-got-it-working",
563566
"check-on-the-status-of-a-fine-tune-session",
567+
"check-the-status-of-a-session",
564568
"clone-repo-and-set-up-env-file",
565569
"come-talk-to-us",
566570
"components",
@@ -570,6 +574,8 @@
570574
"control-plane-environment-variables",
571575
"control-plane-interaction",
572576
"create-a-text-fine-tuning-session",
577+
"create-an-inference-session",
578+
"create-inference-sessions",
573579
"creating-a-bot",
574580
"creating-a-website",
575581
"creating-the-api-tool-in-helix",
@@ -578,15 +584,16 @@
578584
"deleting-a-bot",
579585
"deleting-a-website",
580586
"deployment-on-docker-compose",
581-
"easy-to-use-api",
582587
"embedding-the-helix-chat-widget-in-your-react-app",
583588
"embedding-the-helix-chat-widget-in-your-web-page",
584589
"enabling-helix-apps",
585590
"example",
586591
"example-gptscript",
587592
"example-helixyaml",
588593
"example-javascript-code",
594+
"example-request-and-response",
589595
"example-sessions",
596+
"explore-session-metadata",
590597
"good-prompts-to-try-for-mistral-7b-chatgpt-alternative",
591598
"good-prompts-to-try-for-sdxl-stable-diffusion-xl",
592599
"gptscript-tips",
@@ -606,6 +613,7 @@
606613
"how-helix-works",
607614
"how-to-create-a-basic-app",
608615
"how-to-use-this-documentation",
616+
"http-request",
609617
"image-models",
610618
"important-notes",
611619
"inference-best-practices",
@@ -622,6 +630,7 @@
622630
"now-lets-fine-tune-a-text-model",
623631
"now-lets-fine-tune-an-image-model",
624632
"overriding-query-parameters",
633+
"parameters",
625634
"preview",
626635
"prompt-execution",
627636
"props",
@@ -636,6 +645,7 @@
636645
"runners",
637646
"saving-and-canceling",
638647
"search-theme-options",
648+
"session-data",
639649
"setup-helix",
640650
"setup-keycloak",
641651
"share-results",

0 commit comments

Comments
 (0)