Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains

Here is how to use @MistralAI experimental Mistral-medium using @simonw's https://llm.datasette.io CLI:

  1. Edit the OpenAI-compatible models configuration file:
vi "$(dirname "$(llm logs path)")"/extra-openai-models.yaml
  1. Add the following and save:
- model_id: mistral-tiny
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.output_parser import StrOutputParser
import requests
from bs4 import BeautifulSoup
from langchain.schema.runnable import RunnablePassthrough, RunnableLambda
from langchain.utilities import DuckDuckGoSearchAPIWrapper
import json
RESULTS_PER_QUESTION = 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bonadio
bonadio / self_execute_function_agent.py
Last active April 7, 2024 00:10
Autogen Agent that can auto execute a function_call
# %%
import os
import openai
# import autogen
from autogen import Agent, ConversableAgent, oai, UserProxyAgent, AssistantAgent
import types
from dotenv import load_dotenv, find_dotenv
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
_ = load_dotenv(find_dotenv()) # read local .env file
@disler
disler / the-fishermans-prompt
Created October 2, 2023 12:50
Fisherman's Prompt
I'm a [your level] [profession] and I want to learn [topic] so I can [objective]. Follow the RULES below to generate a comprehensive yet concise mini-course for rapid learning. The course should contain chapters that teach me about these SUB_TOPICS. Make sure the chapters fit my level, profession and topic. Ask for clarification if you need more information about my knowledge.
SUB_TOPICS
- [topic 1]
- [topic 2]
- [topic 3]
RULES
- Use concrete examples to explain every concept
- Use emojis to add expression
@lmammino
lmammino / README.md
Last active March 19, 2024 18:37
Setup SSM to connect your VSCode to a remote Cloud9 Instance (awsbites.com)

Initial steps

  1. Launch Cloud9 IDE with SSM option
  2. When it launchers, open the Cloud9 IDE in the AWS Console

With SSM

Install:

  • AWS CLI
@init27
init27 / app.py
Last active February 13, 2024 14:39
ArXiv Chat: Chat with the latest Arxiv papers
# Credit 🙏: I just used the example from langchain docs and it works quite well: https://python.langchain.com/en/latest/use_cases/question_answering.html
# Note 2: The Arxiv -> PDF logic is a bit messy, I'm sure it can be done better
# Note 3: Please install the following:
# To run:
# Save this in a `app.py`
# pip install arxiv PyPDF2 langchain chromadb
# The chat feature was shipped in H2O nightly this week, we will need to install from nightly link: