Skip to content

Instantly share code, notes, and snippets.

View davila7's full-sized avatar
🤖
Building IA tools with LLMs

Daniel Avila davila7

🤖
Building IA tools with LLMs
View GitHub Profile
Respuesta de Gemini-exp-1114:
Let's break down this Python code snippet step-by-step, focusing on its purpose, functionality, and the key concepts it employs.
Purpose:
import boto3
from botocore.exceptions import ClientError
import json # Added import for json
def create_public_s3_file(bucket_name: str, file_path: str, object_key: str) -> bool:
"""
Creates an S3 bucket (if it doesn't exist), uploads a file, and makes it publicly accessible.
Args:
bucket_name: The name of the S3 bucket.
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello1": "World"}
@app.get("/items/")
def read_items():
import os
import openai
from openai.embeddings_utils import get_embedding, cosine_similarity
import streamlit as st
import pandas as pd
import numpy as np
from ast import literal_eval
import nomic
from nomic import atlas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const few_shot_text = `Bot: Ask me any question.
Me: Can I ask you something about programming?.
Bot: Yes, of course. Tell me your question and I will answer it
Me: My question about Javascript is: Write a JavaScript function to apply Bubble Sort algorithm.
Bot:
Here is a JavaScript function to apply Bubble Sort algorithm:
function bubbleSort(arr) {
let swapped;
do {
swapped = false;
const one_shot_text = 'Bot: Ask me any question. '+
'Me: Can I ask you something about programming?. '+
'Bot: Yes, of course. Tell me your question and I will answer it. '+
'Me: My question about Javascript is: Write a JavaScript function to apply Bubble Sort algorithm.'+
'Bot:';
async function main() {
const completion = await openai.createCompletion({
model: "text-davinci-003",
prompt: one_shot_text,
temperature: 0,
const zero_shot_text = 'Write a function in Javascript';
async function main() {
const completion = await openai.createCompletion({
model: "text-davinci-003",
prompt: zero_shot_text,
temperature: 0.3,
max_tokens: 100,
top_p: 1.0,
frequency_penalty: 0.5,
presence_penalty: 0.0,
#rds
rds = boto3.client('rds', region_name='us-east-1')
# Obtenemos una lista de todas las instancias RDS
rds_instances = rds.describe_db_instances()
stopRdsInstances = []
#recorremos las instancias y filtramos por tag
for rds_instance in rds_instances["DBInstances"]:
tags = rds.list_tags_for_resource(ResourceName=rds_instance["DBInstanceArn"])
# Definimos nuestro tag
tag_name = 'Staging'
#instancias EC2
ec2 = boto3.resource('ec2', region_name='us-east-1')
instances = ec2.instances.filter(Filters=[
{
'Name': 'instance-state-name',
'Values': ['running']