Skip to content

Instantly share code, notes, and snippets.

@bborn
bborn / test.html
Last active February 7, 2024 18:00
<html>
<title>Test</title>
<body>
This is a test.
<script>
// Create a new div
const div = document.createElement('div');
// Set the div's text content to 'foo'
@bborn
bborn / RestrictedPython Repl
Created March 16, 2023 21:08
Python Repl tool using RestrictedPython
"""A tool for running python code in a REPL."""
import ast
from io import StringIO
import sys
from typing import Dict, Optional
from pydantic import Field, root_validator
from langchain.tools.base import BaseTool
BASE_URL=https://app.agent-hq.io/api/v1
API Documentation
------
The API endpoint /agents/AGENT_ID/run is used to run an Agent or ask it a question
Here's an example of a POST to the /agents/AGENT_ID/run endpoint
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY" -d '{
"input": "what is my name?",
BASE URL: https://api.open-meteo.com/
API Documentation
The API endpoint /v1/forecast accepts a geographical coordinate, a list of weather variables and responds with a JSON hourly weather forecast for 7 days. Time always starts at 0:00 today and contains 168 hours. All URL parameters are listed below:
Parameter Format Required Default Description
latitude, longitude Floating point Yes Geographical WGS84 coordinate of the location
hourly String array No A list of weather variables which should be returned. Values can be comma separated, or multiple &hourly= parameter in the URL can be used.
daily String array No A list of daily weather variable aggregations which should be returned. Values can be comma separated, or multiple &daily= parameter in the URL can be used. If daily weather variables are specified, parameter timezone is required.
current_weather Bool No false Include current weather conditions in the JSON output.
llm=OpenAI(temperature=0)
template = """
Assistant is a large language model trained by OpenAI.
Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.
Overall, Assistant is a powerful tool that can help with a wide
def prepare_prompt(params, user)
prompt = '"""'
prompt += "" "Person is named #{user.name}. " ""
prompt += "" "
Person has access to a Writing Assistant, which is a large language model trained by OpenAI.
Writing Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Writing Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
from gpt_index import GPTSimpleVectorIndex, SimpleDirectoryReader, SimpleWebPageReader
from gpt_index.readers.schema.base import Document
import requests
import tempfile
import magic
import re
import html2text
def remote_url_loader(url, query):
@bborn
bborn / 1.html
Last active October 3, 2016 19:13
<a class="rcptr" href="http://www.rafflecopter.com/rafl/display/2faae12324/" rel="nofollow" data-raflid="2faae12324" data-theme="classic" data-template="" id="rcwidget_8vh5exmq">a Rafflecopter giveaway</a>
<script src="https://widget-prime.rafflecopter.com/launch.js"></script>
<a class="rcptr" href="http://www.rafflecopter.com/rafl/display/2faae12321/" rel="nofollow" data-raflid="2faae12321" data-theme="classic" data-template="" id="rcwidget_n8bc9m2w">a Rafflecopter giveaway</a>
<script src="https://widget-prime.rafflecopter.com/launch.js"></script>
<a class="rcptr" href="http://www.rafflecopter.com/rafl/display/2faae12318/" rel="nofollow" data-raflid="2faae12318" data-theme="classic" data-template="" id="rcwidget_b50ha5x1">a Rafflecopter giveaway</a>
<script src="//widget-prime.rafflecopter.com/launch.js"></script>