Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
"""This is an example of how to use async langchain with fastapi and return a streaming response. | |
The latest version of Langchain has improved its compatibility with asynchronous FastAPI, | |
making it easier to implement streaming functionality in your applications. | |
""" | |
import asyncio | |
import os | |
from typing import AsyncIterable, Awaitable | |
import uvicorn | |
from dotenv import load_dotenv |
# 1. Create service account | |
#. * Service Account Token Creator | |
#. * Artifact Registry Writer | |
# 2. Generate service account key | |
#. * In GitHub project -> Settings -> Secrets -> Actions -> New Repository Secret | |
#. Name: GCP_CREDENTIALS | |
#. Value: key.json contents | |
# 3. Create repo in artifact repository | |
#. * Name: $env.REPOSITORY below | |
#. * Region: $env.GAR_LOCATION below |
provider "google" { | |
region = var.gcp_region | |
} | |
resource "random_id" "id" { | |
byte_length = 2 | |
prefix = "${replace(lower(var.gcp_project_name), "/\\s+/", "-")}-" | |
} | |
resource "google_project" "project" { |
version: '3.8' | |
services: | |
mailhog: | |
image: mailhog/mailhog:v1.0.0 | |
container_name: mailhog | |
expose: | |
- 1025 | |
- 8025 | |
ports: |
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
Sample SAM Template using Application Auto Scaling + Provisioned Concurrency | |
Globals: | |
Function: | |
Timeout: 30 |
A Uniform Resource Identifier (URI) is a string of characters that unambiguously identifies a particular resource. To guarantee uniformity, all URIs follow a predefined set of syntax rules,[1] but also maintain extensibility through a separately defined hierarchical naming scheme (e.g. "http://").
Such identification enables interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. Schemes specifying a concrete syntax and associated protocols define each URI. The most common form of URI is the Uniform Resource Locator (URL), frequently referred to informally as a web address. More rarely seen in usage is the Uniform Resource Name (URN), which was designed to complement URLs by providing a mechanism for the identification of resources in particular namespaces.
The common parts of a URI are described below.
def s3_to_pandas(client, bucket, key, header=None): | |
# get key using boto3 client | |
obj = client.get_object(Bucket=bucket, Key=key) | |
gz = gzip.GzipFile(fileobj=obj['Body']) | |
# load stream directly to DF | |
return pd.read_csv(gz, header=header, dtype=str) | |
def s3_to_pandas_with_processing(client, bucket, key, header=None): |