Commit d771356
authored
docs: Add more examples how to use this SDK (#15)
* docs(examples): Add example environment configuration and README files for SDK usage
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs: Update README to include pre-requisites for using the Typescript SDK examples
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(examples): Update example links in README and add list example README
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(examples): Add examples for chat, list, and MCP using Inference Gateway SDK
- Created a chat example with package.json, tsconfig.json, and index.ts to demonstrate chat completions and streaming responses.
- Added a list example with package.json, tsconfig.json, and index.ts for listing models and MCP tools.
- Included README.md files for both chat and list examples with instructions for getting started.
- Added .gitignore files to exclude node_modules in both list and MCP examples.
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(exmaples): Add sample files and configuration for MCP example
- Created a new directory with sample files for the MCP filesystem server, including `sample.txt`, `data.json`, and `config.yaml`.
- Added a README.md file to describe the purpose and usage of the sample data.
- Implemented a TypeScript configuration file (`tsconfig.json`) for the MCP example.
- Created a package.json and package-lock.json for managing dependencies in the examples directory.
- Updated the OpenAPI specification to include new endpoints and improved formatting for consistency.
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(examples): Update LLM model references to remove provider prefix
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(mcp): Add note to ensure no containers are running before starting the example
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* feat: Support both local tools and remote MCP tools; Add onMCPTool callback
- Created a new MCP Web Search Server with a package.json file.
- Updated the main MCP package.json to include example scripts for remote and local tools.
- Added a .gitignore file in the shared directory to exclude unnecessary files.
- Removed outdated README.md, config.yaml, data.json, and sample.txt files from the shared directory.
- Introduced a new sample_sales_data.csv file for demonstration purposes.
- Enhanced the client.ts to support MCP tool callbacks and improved streaming response processing.
Signed-off-by: Eden Reich <eden.reich@gmail.com>
* docs(examples): Refactor MCP examples and client for improved error handling and token tracking
- Updated docker-compose.yml to set environment to production and commented out optional Ollama service.
- Enhanced example-mcp-tools.ts to use console.info for logging and added model availability checks.
- Modified index.ts to implement token tracking for prompt and completion tokens, displaying usage metrics at the end.
- Improved filesystem MCP server (index.js) to use console.info for logging and ensure consistent messaging.
- Updated web-search MCP server (index-http.js and index.js) to use console.info for logging and improved request handling.
- Enhanced InferenceGatewayClient to handle mid-stream errors and added type definitions for stream chunks that may contain errors.
Signed-off-by: Eden Reich <eden.reich@gmail.com>
---------
Signed-off-by: Eden Reich <eden.reich@gmail.com>1 parent 177e9f3 commit d771356
File tree
44 files changed
+9839
-495
lines changed- examples
- chat
- list
- mcp
- mcp-servers
- filesystem
- web-search
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
44 files changed
+9839
-495
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
238 | | - | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
264 | | - | |
| 266 | + | |
265 | 267 | | |
266 | 268 | | |
267 | 269 | | |
| |||
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
295 | 301 | | |
296 | 302 | | |
297 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
13 | 26 | | |
14 | 27 | | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
19 | | - | |
| 32 | + | |
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
| |||
25 | 38 | | |
26 | 39 | | |
27 | 40 | | |
28 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
29 | 50 | | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
33 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
34 | 63 | | |
35 | 64 | | |
36 | 65 | | |
| |||
45 | 74 | | |
46 | 75 | | |
47 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
48 | 107 | | |
49 | 108 | | |
50 | | - | |
51 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
52 | 125 | | |
53 | 126 | | |
54 | 127 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
0 commit comments