-
Notifications
You must be signed in to change notification settings - Fork 3
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
Workflow updated with the use of LLMs (using Amazon Bedrock) #3
base: main
Are you sure you want to change the base?
Conversation
|
||
from langchain.prompts import PromptTemplate | ||
from langchain.llms.bedrock import Bedrock | ||
from langchain_community.chat_models import BedrockChat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The official package for accessing bedrock models is now langchain-aws
'claude': 'anthropic.claude-3-haiku-20240307-v1:0', | ||
} | ||
|
||
logging.getLogger().setLevel(os.environ.get('LOG_LEVEL', 'WARNING').upper()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using Powertools for Lambda? They offer a cool structured logging convenience.
augmented_json_format_str = json.dumps(json_format) | ||
|
||
logging.info(f'Extract data prompt') | ||
logging.info(extract_data_prompt.format(json_format=augmented_json_format_str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using a few shot prompting template?
|
||
extract_data_prompt = ChatPromptTemplate.from_messages(messages_data) | ||
|
||
chain_extract_data = extract_data_prompt | llm_data | StrOutputParser() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using structured output or tools to do info extraction?
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.