Possibe auth config

This commit is contained in:
JackColquitt 2024-08-06 13:51:18 -07:00
parent 198835715d
commit 935cbcb3d1
4 changed files with 29 additions and 5 deletions

View file

@ -13,7 +13,7 @@ RUN dnf install -y python3 python3-pip python3-wheel python3-aiohttp \
RUN pip3 install torch --index-url https://download.pytorch.org/whl/cpu RUN pip3 install torch --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install anthropic cohere google-cloud-aiplatform langchain langchain-core \ RUN pip3 install anthropic boto3 cohere google-cloud-aiplatform langchain langchain-core \
langchain-huggingface langchain-text-splitters langchain-community \ langchain-huggingface langchain-text-splitters langchain-community \
pymilvus sentence-transformers transformers huggingface-hub \ pymilvus sentence-transformers transformers huggingface-hub \
pulsar-client && \ pulsar-client && \

View file

@ -209,8 +209,10 @@ services:
- "text-completion-bedrock" - "text-completion-bedrock"
- "-p" - "-p"
- "pulsar://pulsar:6650" - "pulsar://pulsar:6650"
# - "-m" - "-z"
# - "mistral.mistral-large-2407-v1:0" - "{AWS_ID_KEY}"
- "-k"
- "{AWS_SECRET_KEY}"
restart: on-failure:100 restart: on-failure:100
text-completion-rag: text-completion-rag:
@ -221,6 +223,10 @@ services:
- "pulsar://pulsar:6650" - "pulsar://pulsar:6650"
# - "-m" # - "-m"
# - "mistral.mistral-large-2407-v1:0" # - "mistral.mistral-large-2407-v1:0"
- "-z"
- "{AWS_ID_KEY}"
- "-k"
- "{AWS_SECRET_KEY}"
- "-i" - "-i"
- "non-persistent://tg/request/text-completion-rag" - "non-persistent://tg/request/text-completion-rag"
- "-o" - "-o"

View file

@ -19,3 +19,4 @@ google-cloud-aiplatform
pyyaml pyyaml
prometheus-client prometheus-client
pyarrow pyarrow
boto3

View file

@ -28,7 +28,8 @@ class Processor(ConsumerProducer):
output_queue = params.get("output_queue", default_output_queue) output_queue = params.get("output_queue", default_output_queue)
subscriber = params.get("subscriber", default_subscriber) subscriber = params.get("subscriber", default_subscriber)
model = params.get("model", default_model) model = params.get("model", default_model)
api_key = params.get("api_key") aws_id = params.get("aws_id_key")
aws_secret = params.get("aws_secret")
super(Processor, self).__init__( super(Processor, self).__init__(
**params | { **params | {
@ -43,7 +44,13 @@ class Processor(ConsumerProducer):
self.model = model self.model = model
self.bedrock = boto3.client(service_name='bedrock-runtime', region_name="us-west-2") self.session = boto3.Session(
aws_access_key_id=aws_id,
aws_secret_access_key=aws_secret,
region_name='us-west-2' # e.g., 'us-west-2'
)
self.bedrock = self.session.client(service_name='bedrock-runtime')
print("Initialised", flush=True) print("Initialised", flush=True)
@ -115,6 +122,16 @@ class Processor(ConsumerProducer):
help=f'Bedrock model (default: Mistral-Large-2407)' help=f'Bedrock model (default: Mistral-Large-2407)'
) )
parser.add_argument(
'-z', '--aws-id-key',
help=f'AWS ID Key'
)
parser.add_argument(
'-k', '--aws-secret',
help=f'AWS Secret Key'
)
def run(): def run():
Processor.start(module, __doc__) Processor.start(module, __doc__)