Skip to content

Commit

Permalink
Updating old examples (1/2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus2281 committed Aug 27, 2024
1 parent 14d457d commit 645cd67
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
7 changes: 7 additions & 0 deletions examples/ack_test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
# Simple loopback flow
# Solace -> Pass Through -> Solace
#
# required ENV variables:
# - SOLACE_BROKER_URL
# - SOLACE_BROKER_USERNAME
# - SOLACE_BROKER_PASSWORD
# - SOLACE_BROKER_VPN

log:
stdout_log_level: DEBUG
log_file_level: DEBUG
Expand Down
16 changes: 16 additions & 0 deletions examples/anthropic_bedrock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
# sends the response back to the Solace broker
# It will ask the model to write a dry joke about the input
# message. It takes the entire payload of the input message
#
# Dependencies:
# pip install langchain_aws langchain_community
#
# Dependencies:
# - langchain_aws
# pip install langchain_aws
#
# required ENV variables:
# - SOLACE_BROKER_URL
# - SOLACE_BROKER_USERNAME
# - SOLACE_BROKER_PASSWORD
# - SOLACE_BROKER_VPN
# - AWS_BEDROCK_ANTHROPIC_CLAUDE_MODEL_ID


instance_name: LLM
log:
stdout_log_level: DEBUG
Expand Down
9 changes: 8 additions & 1 deletion examples/chat_model_with_history.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
# Example uses goes from STDIN to STDOUT with a chat model with history
# Example uses goes from STDIN to STDOUT with a chat model with history hosted on AWS Bedrock

# Dependencies:
# pip install langchain_aws

# required ENV variables:
# - AWS_DEFAULT_REGION

log:
stdout_log_level: INFO
log_file_level: DEBUG
Expand Down
46 changes: 38 additions & 8 deletions examples/error_handler.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
---
# This is an example configuration file that contains an
# error handler flow and a test flow. The error handler flow
# will log any error messages locally and will also
# send them to a Solace broker.
# will log any error messages locally to a file and will also
# send them to a Solace broker.
#
# It will subscribe to `my/topic1` and expect an event with the payload:
# {
# "value": <number>
# }
# If value is not a number, the error will be caught, logged to file and send back to the Solace broker.
#
# required ENV variables:
# - SOLACE_BROKER_URL
# - SOLACE_BROKER_USERNAME
# - SOLACE_BROKER_PASSWORD
# - SOLACE_BROKER_VPN

instance:
name: solace_ai_connector1
log:
Expand All @@ -27,12 +40,19 @@ flows:
component_module: error_input
component_config:
- component_name: error_logger
component_module: logger
component_config:
log_level: ERROR
max_log_line_size: 1000
component_module: file_output
input_transforms:
- type: copy
source_expression: input.payload
dest_expression: user_data.log:content
- type: copy
source_value: a
dest_expression: user_data.log:mode
- type: copy
source_value: error_log.log
dest_expression: user_data.log:file_path
component_input:
source_expression: input.payload
source_expression: user_data.log
- component_name: solace_sw_broker
component_module: broker_output
component_config:
Expand Down Expand Up @@ -66,7 +86,7 @@ flows:
- topic: my/topic1
qos: 1
payload_encoding: utf-8
payload_format: text
payload_format: json

- component_name: pass_through
component_module: pass_through
Expand All @@ -89,6 +109,16 @@ flows:
- type: copy
source_expression: input.payload
dest_expression: user_data.output:payload.original_payload
- type: copy
source_expression:
invoke:
module: invoke_functions
function: power
params:
positional:
- source_expression(input.payload:value) # This will throw an error if value is not a number
- 2
dest_expression: user_data.output:payload.valueSquared
- type: copy
source_expression: input.user_properties
dest_expression: user_data.output:payload.user_properties
Expand Down
7 changes: 7 additions & 0 deletions examples/request_reply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# Example for a request-reply flow
# Flow 1: stdin -> broker_request_reply -> stdout
# Flow 2: broker_input -> pass_through -> broker_output
#
# required ENV variables:
# - SOLACE_BROKER_URL
# - SOLACE_BROKER_USERNAME
# - SOLACE_BROKER_PASSWORD
# - SOLACE_BROKER_VPN

log:
stdout_log_level: INFO
log_file_level: INFO
Expand Down

0 comments on commit 645cd67

Please sign in to comment.