Skip to content

Commit

Permalink
add hub examples directory with some existing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lena-larionova committed May 1, 2024
1 parent 42f38f7 commit 4372249
Show file tree
Hide file tree
Showing 12 changed files with 196 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/anthropic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: |
This configuration enables AI Proxy with Anthropic.
Apply this plugin to a route with `"paths[]=~/anthropic-chat$"` configured.
Replace the `<anthropic_key>` with your own API key.
config:
route_type: "llm/v1/chat"
auth:
header_name: "apikey"
header_value: "<anthropic_key>" # add your own Anthropic API key
model:
provider: "anthropic"
name: "claude-2.1"
options:
max_tokens: 512
temperature: 1.0
top_p: 256
17 changes: 17 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
This configuration enables AI Proxy with Azure OpenAI Service.
Apply this plugin to a route with `"paths[]=~/azure-chat$"` configured.
Replace the `<azure_ai_access_key>` with your own API key.
config:
route_type: "llm/v1/chat"
auth:
header_name: "api-key"
header_value: "<azure_ai_access_key>" # add your own Azure OpenAI access key
model:
provider: "azure"
name: "gpt-35-turbo"
options:
azure_instance: "ai-proxy-regression"
azure_deployment_id: "kong-gpt-3-5"
17 changes: 17 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/cohere.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
This configuration enables AI Proxy with Cohere.
Apply this plugin to a route with `"paths[]=~/cohere-chat$"` configured.
Replace the `<cohere_key>` with your own API key.
config:
route_type: "llm/v1/chat"
auth:
header_name: "Authorization"
header_value: "Bearer <cohere_key>" # add your own Cohere API key
model:
provider: "cohere"
name: "command"
options:
max_tokens: 512
temperature: 1.0
13 changes: 13 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/llama2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
description: |
This configuration enables AI Proxy with Llama2.
You need a running Llama2 instance to use this option.
Apply this plugin to a route with `"paths[]=~/llama2-chat$"` configured.
config:
route_type: "llm/v1/chat"
model:
provider: "llama2"
name: "llama2"
llama2_format: "ollama"
upstream_url: "http://llama2-server.local:11434/api/chat"
17 changes: 17 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/mistral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
This configuration enables AI Proxy with Mistral.
You need a running Mistral instance to use this option.
Apply this plugin to a route with `"paths[]=~/mistral-chat$"` configured.
Replace the `<MISTRAL_AI_KEY>` with your own API key.
config:
route_type: "llm/v1/chat"
auth:
header_name: "Authorization"
header_value: "Bearer <MISTRAL_AI_KEY>"
model:
provider: "mistral"
name: "mistral-tiny"
mistral_format: "openai"
upstream_url: "https://api.mistral.ai/v1/chat/completions"
17 changes: 17 additions & 0 deletions app/assets/hub/kong-inc/ai-proxy/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
This configuration enables AI Proxy with OpenAI.
Apply this plugin to a route with `"paths[]=~/openai-chat$"` configured.
Replace the `<openai-key>` with your own API key.
config:
route_type: "llm/v1/chat"
auth:
header_name: "Authorization"
header_value: "Bearer <openai_key>" # add your own OpenAI API key
model:
provider: "openai"
name: "gpt-4"
options:
max_tokens: 512
temperature: 1.0
12 changes: 12 additions & 0 deletions app/assets/hub/kong-inc/http-log/splunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: |
Send Kong Gateway logs to Splunk in raw text using the `/services/collector/raw` Splunk endpoint.
Adjust the `http_endpoint` and its secure token in `headers.Authorization` to your own values.
config:
headers:
Authorization: "Splunk 123456"
http_endpoint: "https://example.splunkcloud.com:8088/services/collector/raw"
method: POST
timeout: 3000
retry_count: 1
15 changes: 15 additions & 0 deletions app/assets/hub/kong-inc/openid-connect/auth0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
description: |
Authenticate headless service consumers using Auth0's identity provider.
This configuration uses the `client_credentials` grant, and requires you to have
an Auth0 API configured with the `openid` scope. Find your `issuer` URL and `audience`
in your Auth0 API configuration.
config:
auth_methods:
- client_credentials
issuer: "https://<auth0 API name>.auth0.com/.well-known/openid-configuration"
audience: "<auth0 API identifier>"

# Need to re-check this example, it looks incomplete. Does it actually work?

17 changes: 17 additions & 0 deletions app/assets/hub/kong-inc/openid-connect/azure-ad.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: |
Authenticate browser clients using an Azure AD identity provider.
Replace the issuer URL, client ID, client secret, redirect URI,
and the custom scope with your own Azure IdP configuration.
config:
issuer: "https://login.microsoftonline.com/YOUR_DIRECTORY_ID/v2.0/.well-known/openid-configuration"
client_id: "YOUR_CLIENT_ID"
client_secret: "YOUR_CLIENT_SECRET"
redirect_uri: "https://example.com/api"
scopes:
- openid
- email
- profile
- "YOUR_CLIENT_ID/.default"
verify_parameters: false
20 changes: 20 additions & 0 deletions app/assets/hub/kong-inc/openid-connect/curity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
description: |
Integrate Kong Gateway and the Curity Identity Server for introspection using the
Phantom Token pattern.
Replace the issuer URL, client ID, and client secret with your own values.
config:
issuer: "https://idsvr.example.com/oauth/v2/oauth-anonymous"
client_id: "YOUR_CLIENT_ID"
client_secret: "YOUR_CLIENT_SECRET"
scopes_required:
- openid
hide_credentials: true
upstream_access_token_header: nil
upstream_headers_claims:
- phantom_token
upstream_headers_names:
- phantom_token
auth_methods:
- introspection
14 changes: 14 additions & 0 deletions app/assets/hub/kong-inc/openid-connect/google.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
description: |
Authenticate browser clients using Google's identity provider.
Replace the issuer URL, client ID, client secret, and redirect URI
with your own Google IdP configuration.
config:
issuer: "https://accounts.google.com/.well-known/openid-configuration"
client_id: "YOUR_CLIENT_ID"
client_secret: "YOUR_CLIENT_SECRET"
redirect_uri: "https://example.com/api"
scopes:
- openid
- email
19 changes: 19 additions & 0 deletions app/assets/hub/kong-inc/openid-connect/okta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
description: |
Authenticate browser clients using Okta.
Replace the issuer URL, client ID, client secret, and redirect URI
with your own Okta configuration values.
config:
issuer: "https://YOUR_OKTA_DOMAIN/oauth2/YOUR_AUTH_SERVER/.well-known/openid-configuration"
client_id: "YOUR_CLIENT_ID"
client_secret: "YOUR_CLIENT_SECRET"
redirect_uri: "https://example.com/api"
scopes_claim:
- scp
scopes:
- openid
- email
- profile
auth_methods:
- authorization_code

0 comments on commit 4372249

Please sign in to comment.