Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

dlaredo
Copy link

@dlaredo dlaredo commented Jun 25, 2024

Issue #, if available:

Description of changes:

  • Incorporates LLMs to process the data in a more efficient manner
  • Uses Amazon Bedrock
  • Creates a new data-streamer to test the workflow

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


from langchain.prompts import PromptTemplate
from langchain.llms.bedrock import Bedrock
from langchain_community.chat_models import BedrockChat
Copy link

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())
Copy link

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,
Copy link

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()
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants