Skip to content

Commit aac412f

Browse files
jonwisCory Hendrixson
andauthored
Prepare source drop of SDKs (#50)
* Prepare source drop of SDKs * Get the latest CS SDK update * Fix link * Remove empty test * Pick up foundry-chat project at 822bd658 * Move samples around * Move the sample back next to the SDK for now * Make cloud vs. local a bit more configurable. Just a start. Include launch.json for debugging remove keys * fixup dynamic model selector and do general code cleanup --------- Co-authored-by: Cory Hendrixson <chendrix@microsoft.com>
1 parent 8235b23 commit aac412f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8742
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Visual Studio and Visual Studio Code
2+
bin/
3+
obj/
4+
.vs/
5+

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Foundry Local brings the power of Azure AI Foundry to your local device. It allo
1919

2020
1. Download Foundry Local for your platform (Windows - x64/ARM) from the [releases page](https://github.com/microsoft/Foundry-Local/releases).
2121
2. Install the package by following the on-screen instructions.
22-
2322
3. After installation, access the tool via command line with `foundry`.
2423

2524
2. **Run your first model**
@@ -64,6 +63,15 @@ response = client.chat.completions.create(
6463
print(response.choices[0].message.content)
6564
```
6665

66+
## Controlling Foundry from your App
67+
68+
Start Foundry models from your apps using the `FoundryManager`, available for multiple runtimes as source and
69+
packages:
70+
71+
* [Python](./sdk/python/README.md)
72+
* [Node & JavaScript](./sdk/js/README.md)
73+
* [C# (Preview)](./sdk/cs/src/README.md) - [simple sample](./sdk/cs/samples/ConsoleClient)
74+
6775
## Features & Use Cases
6876

6977
- **On-device inference** - Process sensitive data locally for privacy, reduced latency, and no cloud costs
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Dependencies
2+
node_modules/
3+
package-lock.json
4+
5+
6+
# Build output
7+
dist/
8+
build/
9+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Debug Main Process",
9+
"type": "node",
10+
"request": "launch",
11+
"cwd": "${workspaceFolder}",
12+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
13+
"windows": {
14+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
15+
},
16+
"args": ["."],
17+
"outputCapture": "std",
18+
"console": "integratedTerminal"
19+
},
20+
{
21+
"name": "Debug Renderer Process",
22+
"type": "chrome",
23+
"request": "launch",
24+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
25+
"windows": {
26+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
27+
},
28+
"runtimeArgs": [
29+
"${workspaceFolder}",
30+
"--remote-debugging-port=9222"
31+
],
32+
"webRoot": "${workspaceFolder}",
33+
"timeout": 30000
34+
}
35+
]
36+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Foundry Local Chat Demo
2+
3+
A simple Electron Chat application that can chat with cloud and Foundry local models.
4+
5+
## Prerequisites
6+
7+
- Node.js (v16 or higher)
8+
- To install Node.js on Windows, run:
9+
```powershell
10+
winget install OpenJS.NodeJS
11+
```
12+
- npm comes bundled with Node.js
13+
14+
## Setup Instructions
15+
1. Download the .MSIX and install Foundry for your processor:
16+
[Foundry LKG Release](https://github.com/ai-platform-microsoft/WindowsAIFoundry/releases/tag/0.2.9261.3945)
17+
Then install it using the following powershell command.
18+
```powershell
19+
add-appxpackage <foundryfile>.msix
20+
```
21+
22+
2. Install dependencies:
23+
```powershell
24+
npm install
25+
```
26+
27+
3. Set the following environment variables to your Cloud AI Service
28+
```powershell
29+
YOUR_API_KEY
30+
YOUR_ENDPOINT
31+
YOUR_MODEL_NAME
32+
```
33+
34+
4. Start the application:
35+
```powershell
36+
npm start
37+
```
38+
39+
## Building the Application (not necessary for testing)
40+
41+
To build the application for your platform:
42+
```powershell
43+
# For all platforms
44+
npm run build
45+
46+
# For Windows specifically
47+
npm run build:win
48+
```
49+
50+
The built application will be available in the `dist` directory.
51+
52+
## Project Structure
53+
54+
- `main.js` - Main Electron process file
55+
- `chat.html` - Main application window
56+
- `preload.cjs` - Preload script for secure IPC communication
57+
58+
## Dependencies
59+
60+
- Electron - Cross-platform desktop application framework
61+
- foundry-local-sdk - Local model integration
62+
- OpenAI - Cloud model integration
63+

0 commit comments

Comments
 (0)