Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.docstore.document import Document | |
import boto3 | |
import re | |
def clean_result(res_text): | |
res = re.sub("\s+", " ", res_text).replace("...","") | |
return res | |
def get_query_language(query): | |
# Use Amazon Comprehend to detect the language of the query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Wrapper around Sagemaker InvokeEndpointAsync API.""" | |
from abc import abstractmethod | |
from typing import Any, List, Optional | |
from langchain.callbacks.manager import CallbackManagerForLLMRun | |
from langchain.llms.utils import enforce_stop_tokens | |
from langchain.llms.sagemaker_endpoint import SagemakerEndpoint | |
import boto3, time, os, uuid | |
from botocore.exceptions import ClientError | |
def wait_inference_file(output_url, failure_url, s3_client=None): |