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

Feature request: Instrumentation for popular GenAI frameworks #2625

Open
2 tasks done
mriccia opened this issue Jun 10, 2024 · 2 comments
Open
2 tasks done

Feature request: Instrumentation for popular GenAI frameworks #2625

mriccia opened this issue Jun 10, 2024 · 2 comments
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision need-more-information Requires more information before making any calls

Comments

@mriccia
Copy link

mriccia commented Jun 10, 2024

Use case

With the rise in popularity of GenAI, there are many developers and businesses building new GenAI workloads on AWS Lambda.
Frameworks like Langchain and LlamaIndex make it easy to build GenAI applications. When using these frameworks, it is useful to know what's happening inside of the framework to debug latency issues, quickly identify inputs and outputs from LLM calls, and create alarms when issues arise.
To implement this level of observability, the frameworks rely on Callback mechanisms (e.g. LangChain callbacks, LlamaIndex callbacks).

I am proposing a new module/feature for Powertools that enables Powertools users to simply import a library, and have automatic Traces generated from code that runs within these frameworks.
By providing this feature in Powertools, developers can have Traces directly in AWS X-Ray without the need of implementing their custom callbacks handlers, and without the need of write and maintain additional code.

I would suggest implementing this feature for LangChain initially, and to cover the Traces aspect to begin with.
Later on it may also be useful to have additional features such creating relevant metrics, and automatic instrumentation.

Solution/User Experience

The experience could look like this:

// import the library
import { GenAIObservabilityCallbackHandler } from '@aws-lambda-powertools/genai-observability-provider';

// Create an instance of the handler
const callbackHandler = new GenAIObservabilityCallbackHandler();

...
// Create a sample chain using Langchain
const chain = RunnableSequence.from([
  {
    language: (input) => input.language,
  },
  prompt,
  model,
  new StringOutputParser(),
])
.withConfig({ callbacks: [callbackHandler] }); // configure chain with instance of the callback Handler

Alternative solutions

Today, possible solutions are 2:

  1. build a Callback handler, and leverage Powertools for AWS Lambda to send Traces to AWS X-Ray

  2. use OTEL-compatible libraries like OpenLLMetry and OpenInference to collect the execution data, and configure the AWS Distro for OpenTelemetry

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@mriccia mriccia added triage This item has not been triaged by a maintainer, please wait feature-request This item refers to a feature request for an existing or new utility labels Jun 10, 2024
Copy link

boring-cyborg bot commented Jun 10, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@dreamorosi dreamorosi added tracer This item relates to the Tracer Utility need-customer-feedback Requires more customers feedback before making or revisiting a decision and removed triage This item has not been triaged by a maintainer, please wait tracer This item relates to the Tracer Utility labels Jun 10, 2024
@dreamorosi
Copy link
Contributor

Hi @mriccia - thank you for taking the time to open an issue.

Following our roadmap process I am marking this as idea and labelling it with need-customer-feedback to signify that we'd like to gauge customer demand before making a call.

At least for now, as reported our roadmap, we are focused on other key areas that have shown significant customer demand both via reactions on their respective issues (sorted list of most requested issues) and via private conversations.

Similar to most AWS products we continuously re evaluate our roadmap based on demand, so I would encourage everyone who comes across this issue to either leave a 👍 to the OP, leave a comment, or connect with us via our public and private channels to manifest interest in this feature. Depending on the demand we might consider adjusting our prioritization accordingly.

Finally, I'm also tagging @aws-powertools/lambda-python-core and @aws-powertools/lambda-dotnet-core to surface the issue since it was marked as cross-runtime. I have also done the same internally. Also, since you're also an Amazonian, if you have existing customer demand for this, please feel free to reach out via the usual channels.

Thank you!

@dreamorosi dreamorosi added the need-more-information Requires more information before making any calls label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This item refers to a feature request for an existing or new utility need-customer-feedback Requires more customers feedback before making or revisiting a decision need-more-information Requires more information before making any calls
Projects
Development

No branches or pull requests

2 participants