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

feat: add extension doc #463

Merged
merged 2 commits into from
Dec 25, 2024
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
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [Getting Started](ten_agent/getting_started.md)
* [Project Structure](ten_agent/project_structure/overview.md)
* [Understand property.json](ten_agent/project_structure/property_json.md)
* [Understand extension folder](ten_agent/project_structure/extension.md)
* [Run Demo](ten_agent/demo/quickstart.md)
* [Run Playground](ten_agent/playground/quickstart.md)
* [Configure Modules](ten_agent/playground/configure_modules.md)
Expand Down
29 changes: 29 additions & 0 deletions docs/ten_agent/project_structure/extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Understand extension folder

The `ten_packages/extension` folder contains the extension modules. Each extension module is a separate Python/Golang/C++ package.

The extension folder name is often the same as the extension module name, while you can also find the extension module name in the `manifest.json` file under the extension folder. The module name shall be used in the `addon` property of the `property.json` file.

Below is a sample structure of the extension folder:

![Extension Folder Structure](https://github.com/TEN-framework/docs/blob/main/assets/png/extension_folder_struct.png?raw=true)

## Extension Common Files

- manifest.json: This file contains the metadata of the extension. It includes the extension name, version, properties, and apis (data, audio_frame, video_frame).
- property.json: This file contains the default properties of the extension. It is used to define the default configuration of the extension.

## Python Extension

- extension.py: This file contains the main logic of the extension. It usually contains the core implementation of the extension.
- requirements.txt: This file contains the Python dependencies required by the extension. Dependencies specified in this file will be installed automatically when you run `task use`.

## Golang Extension

- <xxx>_extension.go: This file contains the main logic of the extension. It usually contains the core implementation of the extension.
- go.mod: This file contains the Go module definition. It specifies the module name and the dependencies of the extension.

## C++ Extension

- src/main.cc: This file contains the main logic of the extension. It usually contains the core implementation of the extension.
- BUILD.gn: This file contains the build configuration of the extension. It specifies the target name and dependencies of the extension.
6 changes: 3 additions & 3 deletions docs/ten_agent/project_structure/property_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The `property` section of a node contains the configuration of the extension. It
}
```

![Property JSON nodes](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_nodes.png?raw=true)
![Property JSON nodes](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_connections.png?raw=true)

#### Read environment variables

Expand Down Expand Up @@ -71,6 +71,6 @@ The `connections` section contains the list of connections between nodes. Each c
}
```

![Property JSON Connections](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_connections.png?raw=true)
![Property JSON Connections](https://github.com/TEN-framework/docs/blob/main/assets/png/property_json_nodes.png?raw=true)

In the above example, we are connecting `agora_rtc` extension to `deepgram_asr` extension. The `agora_rtc` extension is sending `pcm_frame` data to `deepgram_asr` extension.
In the above example, we are connecting `agora_rtc` extension to `deepgram_asr` extension. The `agora_rtc` extension is sending `pcm_frame` data to `deepgram_asr` extension.
Loading