Skip to content

Commit

Permalink
feat: add extension doc (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
plutoless authored Dec 25, 2024
1 parent 2475d63 commit 60aeb77
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
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.

0 comments on commit 60aeb77

Please sign in to comment.