diff --git a/docs/framework/ai-module.mdx b/docs/framework/ai-module.mdx
index 3a74f48d3..b156bb340 100644
--- a/docs/framework/ai-module.mdx
+++ b/docs/framework/ai-module.mdx
@@ -20,7 +20,7 @@ You can manage your environment variables using methods that best suit your setu
Furthermore, when deploying an application with `writer deploy`, the `WRITER_API_KEY` environment variable is automatically configured with the API key specified during the deployment process.
-## Conversation class
+## Chat completion with the Conversation class
The `Conversation` class manages LLM communications within a chat framework, storing the conversation history and handling the interactions.
```python
@@ -74,13 +74,7 @@ conversation += {"role": "user", "content": "Can you break down the assets secti
conversation.add(role="user", content="How should I interpret the equity section?")
```
-Addition to `Conversation` only works against `dict` objects that contain `"role"` and `"content"` items. Providing a `"chunk": True` flag into the object will merge it against the last message - appending `"content"` and replacing other values.
-
### Completing and streaming Conversations
-
-When utilizing the `stream_complete` feature, the initial chunk of data returned by the stream is not specifically marked as a "chunk." This is intentional, allowing for the seamless integration of this first piece into the conversation history when appended using the + operator.
-
-
The `complete` and `stream_complete` methods facilitate interaction with the LLM based on the accumulated messages and configuration. These methods execute calls to generate responses and return them in the form of a message object, but do not alter the conversation's `messages` list, allowing you to validate or modify the output before deciding to add it to the history.
@@ -105,8 +99,8 @@ Instance-wide configuration parameters can be complemented or overriden on indiv
response = conversation.complete(config={'max_tokens': 200, 'temperature': 0.5})
```
-## Text completions without a conversation state
-These `complete` and `stream_complete` methods are designed for one-off text completions without the need to manage a conversation state. They return the model's response as a string. Each function accepts a `config` dictionary allowing call-specific configurations.
+## Text generation without a conversation state
+These `complete` and `stream_complete` methods are designed for one-off text generation without the need to manage a conversation state. They return the model's response as a string. Each function accepts a `config` dictionary allowing call-specific configurations.
```python complete
diff --git a/docs/framework/authentication.mdx b/docs/framework/authentication.mdx
index 0ab725f0d..7bd7fbf73 100644
--- a/docs/framework/authentication.mdx
+++ b/docs/framework/authentication.mdx
@@ -2,9 +2,7 @@
title: "Authentication"
---
-The Writer Framework authentication module allows you to restrict access to your application.
-
-Framework will be able to authenticate a user through an identity provider such as Google, Microsoft, Facebook, Github, Auth0, etc.
+The Writer Framework authentication module allows you to restrict access to your application. Framework will be able to authenticate a user through an identity provider such as Google, Microsoft, Facebook, Github, Auth0, etc.
Authentication is done before accessing the application. It is not possible to
@@ -13,19 +11,13 @@ Framework will be able to authenticate a user through an identity provider such
## Use Basic Auth
-Basic Auth is a simple authentication method that uses a username and password. Authentication configuration is done in [the `server_setup.py` module](custom-server.md).
-
-::: warning Password authentication is not safe for critical application
-Basic Auth authentication is not secure for critical applications.
+Basic Auth is a simple authentication method that uses a username and password. Authentication configuration is done in the [server_setup.py module](/framework/custom-server).
-A user can intercept the plaintext password if https encryption fails.
-It may also try to force password using brute force attacks.
-
-For added security, it's recommended to use identity provider (Google, Microsoft, Facebook, Github, Auth0, etc.).
-:::
+
+Password authentication and Basic Auth are not sufficiently secure for critical applications. If HTTPS encryption fails, a user could potentially intercept passwords in plaintext. Additionally, these methods are vulnerable to brute force attacks that attempt to crack passwords. To enhance security, it is advisable to implement authentication through trusted identity providers such as Google, Microsoft, Facebook, GitHub, or Auth0.
+
-*server_setup.py*
-```python
+```python server_setup.py
import os
import writer.serve
import writer.auth
@@ -41,12 +33,12 @@ writer.serve.register_auth(auth)
### Brute force protection
A simple brute force protection is implemented by default. If a user fails to log in, the IP of this user is blocked.
-Writer framework will ban the IP from either the X-Forwarded-For header or the X-Real-IP header or the client IP address.
+Writer framework will ban the IP from either the `X-Forwarded-For` header or the `X-Real-IP` header or the client IP address.
When a user fails to log in, they wait 1 second before they can try again. This time can be modified by
-modifying the value of delay_after_failure.
+modifying the value of `delay_after_failure`.
-
+
## Use OIDC provider
@@ -55,9 +47,7 @@ Here is an example configuration for Google.
![Authentication OIDC Principle](/framework/images/auth.png)
-**server_setup.py**
-
-```python
+```python server_setup.py
import os
import writer.serve
import writer.auth
@@ -88,9 +78,7 @@ The Writer Framework provides pre-configured OIDC providers. You can use them di
You have to register your application into [Google Cloud Console](https://console.cloud.google.com/).
-_server_setup.py_
-
-```python
+```python server_setup.py
import os
import writer.serve
import writer.auth
@@ -108,9 +96,7 @@ writer.serve.register_auth(oidc)
You have to register your application into [Github](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app#registering-a-github-app)
-_server_setup.py_
-
-```python
+```python server_setup.py
import os
import writer.serve
import writer.auth
@@ -128,9 +114,8 @@ writer.serve.register_auth(oidc)
You have to register your application into [Auth0](https://auth0.com/).
-_server_setup.py_
-```python
+```python server_setup.py
import os
import writer.serve
import writer.auth
@@ -147,13 +132,14 @@ writer.serve.register_auth(oidc)
### Authentication workflow
-
+
## User information in event handler
When the `user_info` route is configured, user information will be accessible
in the event handler through the `session` argument.
+
```python
def on_page_load(state, session):
email = session['userinfo'].get('email', None)
@@ -189,8 +175,6 @@ The default authentication error page look like this:
-_streamsync.auth.Unauthorized_
-
| Parameter | Description |
| ----------- | ---------------------- |
| status_code | HTTP status code |
diff --git a/docs/framework/backend-driven-ui.mdx b/docs/framework/backend-driven-ui.mdx
index e78c4c3f3..176e2b91c 100644
--- a/docs/framework/backend-driven-ui.mdx
+++ b/docs/framework/backend-driven-ui.mdx
@@ -98,7 +98,7 @@ with ui.find(container):
### Component methods
-UI manager contains methods linked to each front-end component. For example, in previous code snippets we provide a `ui.Text` method, which is used for creating [Text components](https://www.streamsync.cloud/component-list.html#text).
+UI manager contains methods linked to each front-end component. For example, in previous code snippets we provide a `ui.Text` method, which is used for creating [Text components](https://dev.writer.com/components/text).
This method expects `content: dict` as first argument, which enables you to set the field properties of the component, through corresponding keys:
```python
@@ -147,7 +147,7 @@ In addition to `content`, a set of fields which is specific to the component typ
- **`position: int`**: Determines the display order of the component in relation to its siblings.
Position `0` means that the component is the first child of its parent.
- Position `-2` is used for components – such as [sidebars](https://www.streamsync.cloud/component-list.html#sidebar) – that have a specific reserved position not related to their siblings.
+ Position `-2` is used for components – such as [sidebars](https://dev.writer.com/components/sidebar) – that have a specific reserved position not related to their siblings.
```python
ui.Text(
{"text": "Hello Parent, I'm your first child!"},
@@ -170,7 +170,7 @@ In addition to `content`, a set of fields which is specific to the component typ
ui.Text({"text": "My visibility depends on the @{my_var}!"}, visible="my_var")
```
-- **`handlers: dict[str, callable]`**: Attaches [event handlers](https://www.streamsync.cloud/event-handlers.html) to the component. Each dictionary key represents an event, and its value is the corresponding handler.:
+- **`handlers: dict[str, callable]`**: Attaches [event handlers](https://dev.writer.com/framework/event-handlers) to the component. Each dictionary key represents an event, and its value is the corresponding handler.:
```python
def increment(state):
state["counter"] += 1
@@ -190,7 +190,7 @@ In addition to `content`, a set of fields which is specific to the component typ
# Both approaches yield the same outcome.
```
*A component can be linked to multiple event handlers.*
-- **`binding: dict[str, str]`**: Links the component to a state variable via [binding](https://www.streamsync.cloud/builder-basics.html#binding). The dictionary key is the bindable event, and the value is the state variable's name:
+- **`binding: dict[str, str]`**: Links the component to a state variable via [binding](https://dev.writer.com/framework/builder-basics#binding). The dictionary key is the bindable event, and the value is the state variable's name:
```python
initial_state = wf.init_state({
"header_text": "Default Text"
diff --git a/docs/framework/custom-components.mdx b/docs/framework/custom-components.mdx
index 7b092319e..447d6f6ff 100644
--- a/docs/framework/custom-components.mdx
+++ b/docs/framework/custom-components.mdx
@@ -73,7 +73,7 @@ export default {
};