-
Notifications
You must be signed in to change notification settings - Fork 23
Connector Implementation & Inheritance: Anthropic Claude #499
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
Open
qoweh
wants to merge
33
commits into
aliencube:main
Choose a base branch
from
qoweh:feat/261-ConnectorImplementation-Inheritance-AnthropicClaude
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
4714dd8
refactor: split UI logic in ChatHeader.razor
qoweh 04735cc
test: add integration tests for NewChat button and icon visibility
qoweh a8f0a7d
Merge remote-tracking branch 'upstream/main'
qoweh 6e68171
Merge remote-tracking branch 'origin/main'
qoweh 1f5783c
Merge branch 'aliencube:main' into main
qoweh 5094a9f
Merge branch 'aliencube:main' into main
qoweh 8ed4bfd
Merge branch 'aliencube:main' into main
qoweh 39354bc
Merge branch 'aliencube:main' into main
qoweh cf64868
Merge branch 'aliencube:main' into main
qoweh 6cfef60
Merge branch 'aliencube:main' into main
qoweh aeb63e8
Merge branch 'aliencube:main' into main
qoweh 1e225a0
Merge branch 'main' into feat/261-ConnectorImplementation-Inheritance…
qoweh bb8dcbf
feat: Add support for Anthropic API integration and update documentation
qoweh ebf7b2b
feat: Add documentation for running OpenChat Playground with Anthropi…
qoweh e06184b
feat: Update default model references to Claude Sonnet 4 and adjust a…
qoweh e3dba70
feat: Add support for Anthropic connector in LanguageModelConnector
qoweh 15881b4
feat: Implement Anthropic connector for LanguageModel integration
qoweh 0708685
feat: Enhance AnthropicConnector with improved error handling and add…
qoweh 65b2d5f
Adds documentation for Anthropic connector
qoweh c625f11
Updates documentation to refer to Anthropic models
qoweh 9bc001b
feat: Refactor GetChatClientAsync to improve API client initializatio…
qoweh 4842bc8
Merge branch 'aliencube:main' into main
qoweh 24c3dd5
Merge branch 'main' into feat/261-ConnectorImplementation-Inheritance…
qoweh d23c92b
feat: add max_tokens parameter for Anthropic in appsettings.json
qoweh 92c3eed
feat: add property MaxTokens for Anthropic in AnthropicSettings
qoweh 604dcf3
Merge remote-tracking branch 'origin/main' into feat/261-ConnectorImp…
qoweh 1a58fb7
fix: temporarily disable Anthropic
qoweh 9c51809
test: skip all Anthropic connector tests until enabled
qoweh 06efab1
refactor: update documentation to remove "Claude" references from Ant…
qoweh 99b7de9
Merge branch 'main' into feat/261-ConnectorImplementation-Inheritance…
qoweh 09ad176
feat: add option MaxTokens for parsing option
qoweh cc490d7
Merge branch 'main' into feat/261-ConnectorImplementation-Inheritance…
qoweh 8032506
feat: add constant for '--max-tokens' command-line argument
qoweh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,225 @@ | ||
| # OpenChat Playground with Anthropic | ||
|
|
||
| This page describes how to run OpenChat Playground (OCP) with [Anthropic models](https://docs.claude.com/en/docs/about-claude/models) integration. | ||
|
|
||
| ## Get the repository root | ||
|
|
||
| 1. Get the repository root. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| REPOSITORY_ROOT=$(git rev-parse --show-toplevel) | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| $REPOSITORY_ROOT = git rev-parse --show-toplevel | ||
| ``` | ||
|
|
||
| ## Run on local machine | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Add Anthropic API Key for Claude connection. Make sure you should replace `{{ANTHROPIC_API_KEY}}` with your Anthropic API key. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \ | ||
| set Anthropic:ApiKey "{{ANTHROPIC_API_KEY}}" | ||
| ``` | ||
|
|
||
| ```bash | ||
| # PowerShell | ||
| dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp ` | ||
| set Anthropic:ApiKey "{{ANTHROPIC_API_KEY}}" | ||
| ``` | ||
|
|
||
| > For more details about Anthropic API keys, refer to the doc, [Anthropic API Documentation](https://docs.anthropic.com/claude/reference/getting-started-with-the-api). | ||
|
|
||
| 1. Run the app. The default model OCP uses is [Claude Sonnet 4](https://www-cdn.anthropic.com/6be99a52cb68eb70eb9572b4cafad13df32ed995.pdf). | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ | ||
| --connector-type Anthropic | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` | ||
| --connector-type Anthropic | ||
| ``` | ||
|
|
||
| Alternatively, if you want to run with a different model, say [Claude Opus 4.1](http://www.anthropic.com/claude-opus-4-1-system-card), other than the default one, you can specify it as an argument: | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ | ||
| --connector-type Anthropic \ | ||
| --model claude-opus-4-1 | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell | ||
| dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` | ||
| --connector-type Anthropic ` | ||
| --model claude-opus-4-1 | ||
| ``` | ||
|
|
||
| 1. Open your web browser, navigate to `http://localhost:5280`, and enter prompts. | ||
|
|
||
| ## Run in local container | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Build a container. | ||
|
|
||
| ```bash | ||
| docker build -f Dockerfile -t openchat-playground:latest . | ||
| ``` | ||
|
|
||
| 1. Get Anthropic API Key. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ | ||
| sed -n '/^\/\//d; p' | jq -r '."Anthropic:ApiKey"') | ||
| ``` | ||
|
|
||
| ```bash | ||
| # PowerShell | ||
| $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` | ||
| Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'Anthropic:ApiKey' | ||
| ``` | ||
|
|
||
| 1. Run the app. The default model OCP uses is [Claude Sonnet 4](https://www-cdn.anthropic.com/6be99a52cb68eb70eb9572b4cafad13df32ed995.pdf). | ||
|
|
||
| ```bash | ||
| # bash/zsh - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type Anthropic \ | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from locally built container | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type Anthropic ` | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```bash | ||
| # bash/zsh - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ | ||
| --connector-type Anthropic \ | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from GitHub Container Registry | ||
| docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` | ||
| --connector-type Anthropic ` | ||
| --api-key $API_KEY | ||
| ``` | ||
|
|
||
| Alternatively, if you want to run with a different model, say [Claude Opus 4.1](http://www.anthropic.com/claude-opus-4-1-system-card), other than the default one, you can specify it as an argument: | ||
|
|
||
| ```bash | ||
| # bash/zsh - from locally built container with custom model | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type Anthropic \ | ||
| --api-key $API_KEY \ | ||
| --model claude-opus-4-1 | ||
| ``` | ||
|
|
||
| ```powershell | ||
| # PowerShell - from locally built container with custom model | ||
| docker run -i --rm -p 8080:8080 openchat-playground:latest --connector-type Anthropic ` | ||
| --api-key $API_KEY ` | ||
| --model claude-opus-4-1 | ||
| ``` | ||
|
|
||
| 1. Open your web browser, navigate to `http://localhost:8080`, and enter prompts. | ||
|
|
||
| ## Run on Azure | ||
|
|
||
| 1. Make sure you are at the repository root. | ||
|
|
||
| ```bash | ||
| cd $REPOSITORY_ROOT | ||
| ``` | ||
|
|
||
| 1. Login to Azure. | ||
|
|
||
| ```bash | ||
| azd auth login | ||
| ``` | ||
|
|
||
| 1. Check login status. | ||
|
|
||
| ```bash | ||
| azd auth login --check-status | ||
| ``` | ||
|
|
||
| 1. Initialize `azd` template. | ||
|
|
||
| ```bash | ||
| azd init | ||
| ``` | ||
|
|
||
| > **NOTE**: You will be asked to provide environment name for provisioning. | ||
|
|
||
| 1. Get Anthropic API Key. | ||
|
|
||
| ```bash | ||
| # bash/zsh | ||
| API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ | ||
| sed -n '/^\/\//d; p' | jq -r '."Anthropic:ApiKey"') | ||
| ``` | ||
|
|
||
| ```bash | ||
| # PowerShell | ||
| $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` | ||
| Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'Anthropic:ApiKey' | ||
| ``` | ||
|
|
||
| 1. Set Anthropic API Key to azd environment variables. | ||
|
|
||
| ```bash | ||
| azd env set ANTHROPIC_API_KEY $API_KEY | ||
| ``` | ||
|
|
||
| The default model OCP uses is [Claude Sonnet 4](https://www-cdn.anthropic.com/6be99a52cb68eb70eb9572b4cafad13df32ed995.pdf). If you want to run with a different model, say [Claude Opus 4.1](http://www.anthropic.com/claude-opus-4-1-system-card), other than the default one, add it to azd environment variables. | ||
|
|
||
| ```bash | ||
| azd env set ANTHROPIC_MODEL claude-opus-4-1 | ||
| ``` | ||
|
|
||
| 1. Set the connector type to `Anthropic`. | ||
|
|
||
| ```bash | ||
| azd env set CONNECTOR_TYPE Anthropic | ||
| ``` | ||
|
|
||
| 1. Run the following commands in order to provision and deploy the app. | ||
|
|
||
| ```bash | ||
| azd up | ||
| ``` | ||
|
|
||
| > **NOTE**: You will be asked to provide Azure subscription and location for deployment. | ||
|
|
||
| Once deployed, you will be able to see the deployed OCP app URL. | ||
|
|
||
| 1. Open your web browser, navigate to the OCP app URL, and enter prompts. | ||
|
|
||
| 1. Clean up all the resources. | ||
|
|
||
| ```bash | ||
| azd down --force --purge | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.