date_collected
stringclasses
1 value
repo_name
stringlengths
6
116
file_name
stringlengths
2
220
file_contents
stringlengths
13
357k
prompts
list
2024-01-10
normand1/HyperFeeder
podcastTextGenerationApp~podcastIntroPlugins~utilities~podcastIntroWriter.py
from langchain.prompts import PromptTemplate from langchain.llms import OpenAI from langchain.chains import LLMChain import os class PodcastIntroWriter: def writeIntro(self, allStoryTitles, podcastName, typeOfPodcast): llm = OpenAI( model=os.getenv("OPENAI_MODEL_SUMMARY"), max_toke...
[ "INTRO_TEMPLATE_STRING", "typeOfPodcast", "podcastName", "allStoryTitles" ]
2024-01-10
normand1/HyperFeeder
podcastTextGenerationApp~podcastOutroWriterPlugins~outroWriterPlugin.py
import os from langchain.prompts import PromptTemplate from langchain.llms import OpenAI from langchain.chains import LLMChain from podcastOutroWriterPlugins.baseOutroWriterPlugin import BaseOutroWriterPlugin class OutroWriterPlugin(BaseOutroWriterPlugin): def identify(self) -> str: return "🎸 outro write...
[ "OUTRO_TEMPLATE_STRING", "introText" ]
2024-01-10
normand1/HyperFeeder
podcastTextGenerationApp~podcastSummaryPlugins~storySummaryPlugin.py
import os from podcastSummaryPlugins.baseSummaryPlugin import BaseSummaryPlugin from langchain import OpenAI from langchain.docstore.document import Document from langchain.chains.summarize import load_summarize_chain from langchain.prompts import PromptTemplate class StorySummaryPlugin(BaseSummaryPlugin): def i...
[ "Write a detailed summary of the following:\n {text}\n DETAILED SUMMARY:" ]
2024-01-10
normand1/HyperFeeder
podcastTextGenerationApp~podcastSegmentWriterPlugins~utilities~storySegmentWriter.py
import os from langchain.prompts import PromptTemplate from langchain.llms import OpenAI from langchain.chains import LLMChain class StorySegmentWriter: def writeSegmentFromSummary(self, storySummary): llm = OpenAI( model=os.getenv("OPENAI_MODEL_SUMMARY"), max_tokens=int(os.getenv(...
[ "storySummary", "SEGMENT_WRITER_STRING" ]
2024-01-10
platisd/sycophant
sycophant.py
#!/usr/bin/env python3 import sys import argparse import json import re from io import BytesIO from datetime import datetime, timedelta from pathlib import Path from openai import OpenAI from bs4 import BeautifulSoup from PIL import Image from jinja2 import Environment, FileSystemLoader import yaml import requests ...
[ "PLACEHOLDER\nPLACEHOLDER", "PLACEHOLDER\n\n```\nPLACEHOLDER\n\nPLACEHOLDER\n```", "You are a helpful assistant who summarizes news articles", "Rewrite the following article but keep the last paragraph if it includes attribution to the original articles and the links to them:\n", "Keep the last paragraph if...
2024-01-10
protella/chatgpt-bots
bot_functions.py
from openai import OpenAI import os from dotenv import load_dotenv from textwrap import dedent import base64 from io import BytesIO from PIL import Image from copy import deepcopy load_dotenv() # load auth tokens from .env file # Default models: https://platform.openai.com/docs/models GPT_MODEL = 'gpt-4-1106-previe...
[ "[{'type': 'text', 'text': ''}]", " Based on the DALL-E 3 prompt, I can imagine an image like this: PLACEHOLDER \n While I can't create or view images,\n I can describe what such an image might look like or the ideas it might convey.\n ...
2024-01-10
bytjn1416124/gpt3-jabebot
jabebot.py
from dotenv import load_dotenv from random import choice from flask import Flask, request import os import openai load_dotenv() #openai.api_key = os.getenv("OPENAI_API_KEY") openai.api_key = "your-openai-api-key-here" completion = openai.Completion() start_sequence = "\nJabe:" restart_sequence = "\n\nPerson:" sessio...
[ "PLACEHOLDER\n\nPerson:: PLACEHOLDERstart_sequencedf9497ed-610c-495d-ac47-20b073407a88:", "You are talking to Jabe, GPT3 bot influencer who was mentored by Elon Musk in the past. Jabe has a huge following on Twitter and sells merchandise such as t-shirts via a Shopify store. He also published funny videos on Yout...
2024-01-10
lewislf/ai-want-coffee
predict~rewritten~coffee_assistant.py
from openai import OpenAI from threading import Thread, Event from queue import Queue import argparse from agent import GPTVisionAgent from image_handler import ImageHandler from time import sleep from cv2 import waitKey system_prompt = ( "Você se chama Clio e é uma Inteligência Computacional Autônoma (ICA) " ...
[ "Você se chama Clio e é uma Inteligência Computacional Autônoma (ICA) do laboratório de Computação de Alto Desempenho (LCAD) da Universidade Federal do Espírito Santo (UFES).\nVocê é uma barista muito prestativa e é responsável por instruir o processo de fazer café coado da forma mais detalhada possível e em qualqu...
2024-01-10
lewislf/ai-want-coffee
predict~AgentLegacy.py
import base64 from openai import OpenAI client = OpenAI() talk = [ {'role': 'system', 'content': 'Você está em uma cozinha e deve trabalhar para fazer café. Para isso foi ' 'atribuído a você um corpo robótico de tamanho semelhante ao humano ' 'que...
[ "Você está em uma cozinha e deve trabalhar para fazer café. Para isso foi atribuído a você um corpo robótico de tamanho semelhante ao humano que responderá de forma precisa às suas instruções desde que você se expresse da forma correta. Você deverá responder no seguinte formato:\n# comentário\nfunção(argumento)\nO ...
2024-01-10
lewislf/ai-want-coffee
predict~rewritten~coffee_agent_v2.py
from openai import OpenAI def main(): client = OpenAI() if __name__ == "__main__": main()
[]
2024-01-10
lewislf/ai-want-coffee
predict~rewritten~coffee_agent.py
from openai import OpenAI from agent import GPTVisionAgent system_prompt = ( "Você está em uma cozinha e deve trabalhar para fazer café. Para isso foi " "atribuído a você um corpo robótico de tamanho semelhante ao humano " "que responderá de forma precisa às suas instruções desde que você se expresse da f...
[ "Você está em uma cozinha e deve trabalhar para fazer café. Para isso foi atribuído a você um corpo robótico de tamanho semelhante ao humano que responderá de forma precisa às suas instruções desde que você se expresse da forma correta. Você deverá responder no seguinte formato:\n# comentário\nfunção(argumento)\nO ...
2024-01-10
lewislf/ai-want-coffee
predict~gpt4vision.py
import openai import requests import json import base64 from api_key import OPENAI_API_KEY def set_pre_configuration(prompt=None): openai.api_key = OPENAI_API_KEY if prompt is None: prompt = [ { 'role': 'system', 'content': ( "Você se ch...
[ "Dada a tarefa, sugira uma tarefa equivalente que possa ser realizada no processo de fazer café.\n Tarefa original: PLACEHOLDER.", "\n Com base na resposta do usuário e na tarefa fornecida, determine a intenção do usuário.\n Se a resposta do usuário sugerir o desejo de capturar uma imagem, classifique a ...
2024-01-10
Kaptan-Usama/pdf_answerer_chatbot
pdf_answerer.py
import streamlit as st import PyPDF2 import io import openai import docx2txt import pyperclip import os from PyPDF2 import PdfMerger st.set_page_config(page_title="PDF Question Answerer", page_icon="📄") st.markdown(""" <style> div[data-baseweb="input"] > div { background: rgba(0,0,0,0.1) !im...
[ "text84b2eaec-1d0f-4b70-bd51-0f517285bf48\nQuestion: PLACEHOLDER\nAnswer:", "text879bacb8-d48a-4426-b455-f7de55cc89cf\nQuestion: PLACEHOLDER\nAnswer:", "\nQuestion: PLACEHOLDER\nAnswer:" ]
2024-01-10
danielpatrickhug/datasets
datasets~openwebtext~openwebtext.py
# coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_sample_csl.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_cl_cr.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_cl_so.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_baseline_ft.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_baseline_pt.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_sample_cfg.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_sample_sct.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_cl_is.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_cl_all.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_baseline_gcl.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_csl.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
IndexFziQ/CLSEG
src~run_generation_sample_tpl.py
#!/usr/bin/env python3 # coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in c...
[]
2024-01-10
adrianmarino/thesis-paper
lib~recommender~chatbot~movie~movie_recommendations_output_parser.py
from langchain.schema import BaseOutputParser from bunch import Bunch from typing import List import util as ut import re import logging from pydantic import BaseModel, PrivateAttr class MovieRecommendationsOutputParser(BaseOutputParser[List[str]]): __list_size: int = PrivateAttr(True) def __init__(self, lis...
[]
2024-01-10
adrianmarino/thesis-paper
lib~recommender~chatbot~stateless~chat_bot_response_factory.py
from .chat_bot_response import ChatBotResponse import logging from langchain_core.messages import SystemMessage class ChatBotResponseFactory: def __init__(self, output_parser, template_factory): self._output_parser = output_parser self._template_factory = template_factory self._logger ...
[]
2024-01-10
adrianmarino/thesis-paper
lib~model~llm~chain_builder.py
from langchain.callbacks.manager import CallbackManager from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler from langchain.llms import Ollama from langchain.chat_models import ChatOllama from langchain.prompts import ChatPromptTemplate class OllamaModelBuilder: @staticmethod def ch...
[ "[('system', PLACEHOLDER), ('human', '{request}')]" ]
2024-01-10
TheItCrOw/R.O.B.E.R.T.
src~training~rob_test_pipeline.py
from db import db from torchmetrics.text.rouge import ROUGEScore from nltk.translate.bleu_score import sentence_bleu import torch import time import random import sys import numpy as np import json import os import gc import openai from datetime import datetime from chat_gpt3 import chat_gpt3 sys.path.append(os.path.j...
[ "inp", "\nA student is having a conversation with Rob, the virtual reality assistant. This is the chat history:\n[HISTORY]\n\nRob knows the following:\n[CONTEXT]\n\nRob continued the dialog with:\n[ANSWER]\n\nRate Robs answer with a number from 1 to 10. Focus heavily on whether the answer has correct information ...
2024-01-10
civrealm/civrealm
src~civrealm~agents~civ_autogpt~GPTAgent.py
import os import openai import time import random import json import requests import warnings from func_timeout import func_timeout from func_timeout import FunctionTimedOut from civrealm.agents.civ_autogpt.utils.num_tokens_from_messages import num_tokens_from_messages from civrealm.agents.civ_autogpt.utils.interact_w...
[ "You should only respond in JSON format as described", "The former chat history can be summarized as: \n", "src/civrealm/agents/civ_autogpt/prompts/state_prompt.txt", "src/civrealm/agents/civ_autogpt/prompts/task_prompt.txt", "You should only use the given commands!", "PLACEHOLDER Now you get the needed i...
2024-01-10
AI-Jie01/auto-evaluator
auto-evaluator.py
import os import json import time import pypdf import random import itertools import text_utils import pandas as pd import altair as alt import streamlit as st from io import StringIO from langchain.llms import Anthropic from langchain.vectorstores import FAISS from langchain.chains import RetrievalQA from langchain.ch...
[ "`Gradeing style prompt`", "Descriptive" ]
2024-01-10
ITM-Kitware/align-system
align_system~cli~run_align_system.py
import sys import json from rich.highlighter import JSONHighlighter from align_system.utils import logging from align_system.interfaces.cli_builder import build_interfaces from align_system.algorithms.llm_baseline import LLMBaseline from align_system.algorithms.llama_index import LlamaIndex from align_system.similari...
[ "unstructured" ]
2024-01-10
ITM-Kitware/align-system
align_system~algorithms~llama_index.py
from langchain.embeddings.huggingface import HuggingFaceEmbeddings from llama_index import ( VectorStoreIndex, SimpleDirectoryReader, LangchainEmbedding, ServiceContext, ) from llama_index.llms import HuggingFaceLLM from llama_index.prompts.prompts import SimpleInputPrompt from llama_index.llm_predictor...
[ "\n", "Write a response that appropriately completes the request.\n\n", "\nPLACEHOLDER", "{query_str}", "scenario", "\nIdentify the integer index of the choice that best completes the request.\n", "Below is an instruction that describes a task. ", "### Instruction:\n{query_str}\n\n### Response:", "C...
2024-01-10
ITM-Kitware/align-system
align_system~cli~run_action_based_align_system.py
import sys import json from rich.highlighter import JSONHighlighter from align_system.utils import logging from align_system.interfaces.cli_builder import build_interfaces from align_system.algorithms.llm_baseline import LLMBaseline from align_system.algorithms.llama_index import LlamaIndex from align_system.similari...
[ "unstructured", "mission", "casualties" ]
2024-01-10
jaredbradley243/docsgpt
scripts~code_docs_gen.py
import ast import json from pathlib import Path import dotenv from langchain.llms import OpenAI from langchain.prompts import PromptTemplate dotenv.load_dotenv() ps = list(Path("inputs").glob("**/*.py")) data = [] sources = [] for p in ps: with open(p) as f: data.append(f.read()) sources.append(p) ...
[ "Code: \n{code}, \nDocumentation: " ]
2024-01-10
jaredbradley243/docsgpt
application~parser~py2doc.py
import ast import os from pathlib import Path import tiktoken from langchain.llms import OpenAI from langchain.prompts import PromptTemplate def find_files(directory): files_list = [] for root, dirs, files in os.walk(directory): for file in files: if file.endswith('.py'): ...
[ "Code: \n{code}, \nDocumentation: ", "functions_names", "class_name", "Class name: {class_name} \nFunctions: {functions_names}, \nDocumentation: " ]
2024-01-10
phasetr/generative-ai
fundamentals~tts.py
import os import traceback from uuid_extensions import uuid7str from openai import OpenAI class TTS: """_summary_ 適当なテキストから音声ファイルを作る。 """ def __init__(self, uuid) -> None: self.uuid = uuid self.output_directory_name = os.environ.get( "OUTPUT_DIRECTORY_NAME", "output") ...
[]
2024-01-10
phasetr/generative-ai
2023-08-21-lang-chain-streamlit~Chapter04~get_costs.py
from langchain.llms import OpenAI from langchain.callbacks import get_openai_callback llm = OpenAI(model_name="gpt-3.5-turbo") with get_openai_callback() as cb: result = llm("Tell me a joke") print(cb)
[]
2024-01-10
phasetr/generative-ai
2023-12-21-Modern_Generative_AI_with_ChatGPT_and_OpenAI_Models~Chapter10-Enterprise_use_cases~code~medical_smart_search_app.py
import os import streamlit as st from langchain.chains.question_answering import load_qa_chain from langchain.document_loaders import PyPDFLoader from langchain.embeddings import OpenAIEmbeddings from langchain.llms import AzureOpenAI from langchain.vectorstores.faiss import FAISS with open('secrets.toml', 'r') as f:...
[]
2024-01-10
phasetr/generative-ai
2023-11-26-hackathon-note~1_text_to_mp3.py
import os from uuid_extensions import uuid7str from openai import OpenAI from pathlib import Path sample_text_name = "sample1.txt" is_exist = os.path.exists(sample_text_name) if not is_exist: print(f"{sample_text_name}を作成してください。") exit() print("テキストを読み込みます。") text = "" with open(sample_text_name, mode="r", en...
[]
2024-01-10
phasetr/generative-ai
fundamentals~poll.py
from openai import OpenAI from uuid_extensions import uuid7str import dotenv import os # APIキーの設定 dotenv.load_dotenv() client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY')) class OpenAIAdapter: def __init__(self, file_root) -> None: self.file_root = file_root self.output_directory_name = os.e...
[]
2024-01-10
phasetr/generative-ai
fundamentals~stt.py
import traceback from openai import OpenAI import os class STT: def __init__(self) -> None: self.output_directory_name = os.environ.get( "OUTPUT_DIRECTORY_NAME", "output") # ディレクトリがなければ作る if not os.path.exists(self.output_directory_name): os.mkdir(self.output_direct...
[]
2024-01-10
phasetr/generative-ai
2023-12-21-Modern_Generative_AI_with_ChatGPT_and_OpenAI_Models~Chapter10-Enterprise_use_cases~code~call_center_app.py
import sys import requests import os import numpy as np import toml from streamlit_chat import message import streamlit as st import openai with open('secrets.toml', 'r') as f: config = toml.load(f) openai.api_type = "azure" openai.api_key = config['OPENAI_API_KEY'] openai.api_base = config['OPENAI_API_BASE'] ope...
[ "Elaborate a list of remediations to get to the following improvement: PLACEHOLDER", "Operator: Good morning, thank you for calling the auto insurance company, my name is John, how can I assist you today?\nCustomer: Yes, hi, I just noticed a dent on the side of my car and I have no idea how it got there. There we...
2024-01-10
phasetr/generative-ai
2023-12-21-Modern_Generative_AI_with_ChatGPT_and_OpenAI_Models~Chapter10-Enterprise_use_cases~code~contract_analyzer_app.py
import sys import toml import streamlit as st import openai with open('secrets.toml', 'r') as f: config = toml.load(f) openai.api_type = "azure" openai.api_key = config['OPENAI_API_KEY'] openai.api_base = config['OPENAI_API_BASE'] openai.api_version = "2022-12-01" contract = """ This Contract for Services ("Agr...
[ "\n\nThis Contract for Services (\"Agreement\") is entered into as of [date], by and between Company A (\"Company\") and Company B (\"Service Provider\").\n1.\tServices Provided. Service Provider agrees to provide the following services to Company (the \"Services\"): The Service Provider agrees to provide consultin...
2024-01-10
phasetr/generative-ai
2023-11-26-hackathon-note~2_img_to_mp3.py
import os from uuid_extensions import uuid7str from openai import OpenAI from pathlib import Path import base64 def encode_image(image_path): """画像をbase64にエンコードする""" with open(image_path, "rb") as image_file: return base64.b64encode(image_file.read()).decode("utf-8") sample_img_name = "img/1.jpg" is...
[ "[{'type': 'text', 'text': '日本語で説明してください'}, {'type': 'image_url', 'image_url': 'data:image/jpeg;base64,PLACEHOLDER'}]" ]
2024-01-10
Azure-Samples/flask-app-on-azure-functions
FlaskApp~__init__.py
from flask import Flask # Always use relative import for custom module from .package.module import MODULE_VALUE app = Flask(__name__) @app.route("/") def index(): return ( "Try /hello/Chris for parameterized Flask route.\n" "Try /module for module import guidance" ) @app.route("/hello/<name>...
[]
2024-01-10
Crazykrai/MakeUC2023
search.py
import os import openai import json import re from googleapiclient.discovery import build from dotenv import load_dotenv from bs4 import BeautifulSoup from urllib.request import Request, urlopen load_dotenv() apiKey = os.getenv('GOOGLE_API_KEY') seId = os.getenv('GOOGLE_CSE_ID') openai.api_key = os.getenv('GPT_KEY') ...
[ "Create a 2 sentence summary of a website's content using the given text from the website alongside the URL: PLACEHOLDER - PLACEHOLDER" ]
2024-01-10
aweidner/ScryBot
scrybot~api~search.py
import sys import asyncio import openai async def search(query): completion = await openai.ChatCompletion.acreate( model="ft:gpt-3.5-turbo-0613:personal::8MPbjnyY", messages=[ {"role": "system", "content": "Act as a scryfall api bot that accepts a user query and translates it into a se...
[ "Act as a scryfall api bot that accepts a user query and translates it into a search URL. Output only the url." ]
2024-01-10
cancelself/geist
geist.py
import os import sys import glob import json import openai import pickle import getpass from datetime import datetime def load_chat_history(file_path): try: with open(file_path, 'rb') as f: chat_history = pickle.load(f) except FileNotFoundError: chat_history = [] return chat_hi...
[ "{'role': 'user', 'content': 'PLACEHOLDERPLACEHOLDER', 'name': PLACEHOLDER}", "content", "PLACEHOLDERPLACEHOLDER" ]
2024-01-10
maioria/chatgpt-talkieai
talkieai-server~app~ai~chat_gpt_ai.py
from typing import List, Dict import json from pydantic import BaseModel from app.ai.interfaces import SystemBaseAI, MessageInvokeDTO from app.ai.models import * from app.core.logging import logging class ChatGPTInvokeDTO(BaseModel): messages: List[Dict] model: str = 'gpt-3.5-turbo' temperature: float = 0...
[]
2024-01-10
jasonthewhale/Indigenous_AI
story_generator.py
import streamlit as st import pandas as pd import numpy as np import openai openai.organization = "org-tlNrDekRRlExHL1gWb7oCHPD" openai.api_key = st.secrets["OPENAI_API_KEY"] df = pd.read_csv('./datasets/indigenous_map.csv') for _, row in df.iterrows(): language_name = row['Language'] new_url = f"https://m...
[ "\nHere is the info about an indigenous language in QLD. Help me create a short and brief, but fascinating story involves language name, introduction, pronunciation, Synonyms, Common words. Also set the background or scene of the story as value of \"Locations\", describing a story bsaed on image attribution. Pls ke...
2024-01-10
wshao12/ChatGPT
src~revChatGPT~ProxyServer.py
""" Fetches cookies from chat.openai.com and returns them (Flask) """ from OpenAIAuth.Cloudflare import Cloudflare from flask import Flask, request, jsonify import tls_client import json app = Flask(__name__) session = tls_client.Session( client_identifier="chrome_108" ) # Get cloudflare cookies cf_clearance, us...
[]
2024-01-10
abuzarmahmood/KatzGPT
katz_gpt_test.py
""" https://levelup.gitconnected.com/langchain-for-multiple-pdf-files-87c966e0c032 """ from langchain.document_loaders import PyPDFLoader, PyPDFDirectoryLoader from glob import glob import os from tqdm import tqdm from joblib import Parallel, delayed from pickle import dump, load from langchain.embeddings import Ope...
[ "question", "You are an AI assistant for answering questions about systems neuroscience, specifically taste processing.\nYou are given the following extracted parts of a long document and a question. Provide a conversational answer.\nIf you don't know the answer, just say \"Hmm, I'm not sure.\" Don't try to make ...
2024-01-10
aishvi-g/healthease
templates~telebot~medease.py
import cohere import os from health_data import health_database, train_data from azure.ai.translation.text import TextTranslationClient, TranslatorCredential from azure.ai.translation.text.models import InputTextItem api_key = os.environ['API_KEY'] azure_key = os.environ['azure_key'] endpoints = os.environ['endpoint']...
[]
2024-01-10
sahuidhsu/GPT-KUnit-coder
display_messages.py
import toml import openai log_file = open("message_log.txt", "w") with open("config.toml") as config_file: config = toml.load(config_file) if not config["OPENAI_API_KEY"]: print("ERROR! Please set your OPENAI_API_KEY in config.toml") exit() def write_output(msg): print(msg) log_file.write(msg + ...
[]
2024-01-10
chuanyang-Zheng/Progressive-Hint
main_clean.py
import copy import os import time import jsonlines import openai import json import re import numpy as np from utils import delete_extra_zero,_strip_string import argparse from statistics import mean from collections import Counter import traceback # OpenAI Key openai.api_key = "Put Your Key Here" def find_ma...
[ "PLACEHOLDER\n\nQ: PLACEHOLDER\nA:", "PLACEHOLDER\n\nQuestion: PLACEHOLDER\nA:", "[]", "Follow the given examples and answer the question." ]
2024-01-10
rick-love/lc-playground
news_parser.py
import datetime from config import get_OpenAI, get_NewsAPIKey from openai import OpenAI from newsapi import NewsApiClient from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate # Import Pydantic from langchain.output_parsers import PydanticOutputParser from pydantic import BaseMo...
[]
2024-01-10
rick-love/lc-playground
chains.py
from config import get_OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate from langchain.chains import LLMChain, SequentialChain import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Exception a...
[ "How do you say good afternoon in {language}?", "language" ]
2024-01-10
rick-love/lc-playground
day4_parsers.py
from OpenAI_Training.config import get_OpenAI from openai import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Exception as e: raise Exception(f"Error setting API key for OpenAI: {e}")...
[ "\nFrom the following email, please extract the following information:\nUser_Id: what is the user id?\n\nImport_ID: what is the import id?\nstart_time: what is the start time?\nend_time: what is the end time?\nerrors: what are the errors? If there are multiple errors, please list them all in square brackets as an a...
2024-01-10
rick-love/lc-playground
chains_story.py
from config import get_OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate from langchain.chains import LLMChain, SequentialChain import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Exception a...
[ "location", "name", "\nAs a childrens book author, write a simple and short (90 words) story lullaby based on the location\n{location}\nand the main character\n{name}\n\nSTORY:\n", "\nTranslate the {story} to {language}.\n\nMake sure the translation is simple and fun to read for children.\n\nTRANSLATION:\n", ...
2024-01-10
rick-love/lc-playground
day3.py
from OpenAI_Training.config import get_api_key from openai import OpenAI from langchain.prompts import FewShotPromptTemplate,PromptTemplate from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.embeddings import OpenAIEmbeddings from langchain.schema import HumanMessage, SystemMe...
[ "\nI really want to travel to {location}. What should I do there?\n\nRespond with one short answer.\n\n", "location", "Input: {noun}\nOutput", "Lisbon", "format_instructions", "You are a nice AI bot that helps a user figure out what to eat in one short sentence", "Give the location an item is usually fo...
2024-01-10
rick-love/lc-playground
memory.py
from config import get_OpenAI from openai import OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.chains import ConversationChain from langchain.memory import ConversationBufferMemory import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_...
[]
2024-01-10
rick-love/lc-playground
doesnt_work_speech2text.py
from pathlib import Path from OpenAI_Training.config import get_api_key from openai import OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_api_key() except Exception as e: raise Exception(f"Err...
[]
2024-01-10
rick-love/lc-playground
getWeather.py
# This file is used to get the weather for a given location from config import get_OpenAI, get_OpenWeatherAPIKey from langchain.llms import OpenAI from langchain.agents import AgentType, initialize_agent, load_tools # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Exception as e: raise E...
[]
2024-01-10
rick-love/lc-playground
pydantic_parser.py
from config import get_OpenAI from openai import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate #import Pydantic from langchain.output_parsers import PydanticOutputParser from pydantic import BaseModel, Field, field_validator, validator from typing import List # S...
[ "\nFrom the following email, please extract the following information:\nUser_Id: what is the user id?\n\nImport_ID: what is the import id?\nstart_time: what is the start time?\nend_time: what is the end time?\nerrors: what are the errors? If there are multiple errors, please list them all in square brackets as an a...
2024-01-10
rick-love/lc-playground
getNews.py
from config import get_NewsAPIKey, get_OpenAI from newsapi import NewsApiClient from openai import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate # Set the API key for NewsAPI try: newsapi = NewsApiClient(api_key=get_NewsAPIKey()) except Exception as e: ra...
[]
2024-01-10
rick-love/lc-playground
story_generator.py
from config import get_OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate from langchain.chains import LLMChain, SequentialChain import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Exception a...
[ "location", "name", "\n Translate the {story} to {language}.\n\n Make sure the translation is simple and fun to read for children.\n\n TRANSLATION:\n ", "\n As a childrens book author, write a simple and short (90 words) story lullaby based on the location\n {location}\n ...
2024-01-10
rick-love/lc-playground
blogGenerator.py
from OpenAI_Training.config import get_OpenAI from openai import OpenAI from langchain.llms import OpenAI from langchain.prompts import PromptTemplate from langchain.chains import LLMChain, SequentialChain from langchain.memory import ConversationBufferMemory from langchain.utilities import WikipediaAPIWrapper from lan...
[ "Write a Blog title about {topic}", "Enter your topic:", "Write a Blog article based on this title: {title} while also leveraging this wikipedia research: {wikipedia_research}. The article should be less 500 words long." ]
2024-01-10
rick-love/lc-playground
languageConverter.py
from langchain.llms import OpenAI import streamlit as st from config import get_OpenAI from langchain.prompts import PromptTemplate template = """ Below is a text message that maybe poorly written. Your goal is to: - Properly format the text - Convert the text to the desired tone - Convert the text to the desired lang...
[ "Yo! Your order has shipped.", "Ich schreibe Ihnen, um Sie darüber zu informieren, dass das von Ihnen bestellte Produkt versandt wurde.", "tone", "Hey! Just wanted to let you know that your order has been shipped.", "Le escribo para informarle que el producto que ha pedido ha sido enviado.", "\nBelow is a...
2024-01-10
rick-love/lc-playground
starter.py
from config import get_OpenAI from openai import OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import PromptTemplate from langchain.chains import LLMChain, SequentialChain from langchain.memory import ConversationBufferMemory import streamlit as st # Set ...
[]
2024-01-10
rick-love/lc-playground
promptTemplates.py
from OpenAI_Training.config import get_OpenAI, get_PineCone from openai import OpenAI from langchain.llms import OpenAI from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate import streamlit as st # Set the API key for OpenAI try: OpenAI.api_key = get_OpenAI() except Excep...
[ "\n\nTranslates from English to German in a nice tone.\n{human_input}\n\n" ]
2024-01-10
BDSI-Utwente/steers
ingest~deprecated~04-topics_openai.py
from dotenv import load_dotenv load_dotenv(".env") from database import * import openai from openai.error import RateLimitError import os import random import backoff from peewee import DataError openai.api_key = os.getenv("OPENAI_APIKEY") # prepare topic getter with exponential backoff baked in @backoff.on_exceptio...
[ "You are a topic extraction engine. When you get a message, you will reply with a comma-separated list of up to 8 topics and concepts that are most relevant to that message." ]
2024-01-10
BDSI-Utwente/steers
ingest~deprecated~03-categories_openai.py
from dotenv import load_dotenv load_dotenv(".env") from database import * import openai from openai.error import RateLimitError import os import random import backoff from typing import List from peewee import DataError openai.api_key = os.getenv("OPENAI_APIKEY") # prepare category getter with exponential backoff ba...
[ "You are an academic library classification engine. When you get a message, you will reply with a comma-separated list of academic domains that best fit the thesis described in the message." ]
2024-01-10
mikelapierre/chat-with-your-data-solution-accelerator
code~utilities~helpers~LLMHelper.py
import openai from typing import List from langchain.chat_models import AzureChatOpenAI from langchain.embeddings import OpenAIEmbeddings from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler from .EnvHelper import EnvHelper class LLMHelper: def __init__(self): env_helper: EnvHelp...
[]
2024-01-10
mikelapierre/chat-with-your-data-solution-accelerator
code~utilities~document_chunking~Layout.py
from typing import List from .DocumentChunkingBase import DocumentChunkingBase from langchain.text_splitter import MarkdownTextSplitter from .Strategies import ChunkingSettings from ..common.SourceDocument import SourceDocument class LayoutDocumentChunking(DocumentChunkingBase): def __init__(self) -> None: ...
[]
2024-01-10
mikelapierre/chat-with-your-data-solution-accelerator
code~utilities~orchestrator~Strategies.py
from enum import Enum class OrchestrationStrategy(Enum): OPENAI_FUNCTION = 'openai_function' LANGCHAIN = 'langchain' def get_orchestrator(orchestration_strategy: str): if orchestration_strategy == OrchestrationStrategy.OPENAI_FUNCTION.value: from .OpenAIFunctions import OpenAIFunctionsOrchestrator...
[]
2024-01-10
zharry29/curious_code_prompts
datasets~imdb~imdb_old.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") parser = argpar...
[ "PLACEHOLDER PLACEHOLDER.\n\n", "Movie Expressed Sentiment" ]
2024-01-10
zharry29/curious_code_prompts
datasets~cnn_dailymail~cnn_dailymail.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from transformers import AutoTokenizer from tqdm import tqdm from rouge import FilesRouge parser = argparse.ArgumentParser() parser.add_argument('--prompt', requ...
[ "cnn_dailymail/3.0.0", "PLACEHOLDERPLACEHOLDER\n\nAnswer: PLACEHOLDER\n\n\n", "{highlights}", "2_or_3_sentences", "PLACEHOLDERPLACEHOLDERPLACEHOLDER\n\n\n" ]
2024-01-10
zharry29/curious_code_prompts
datasets~Winogrande~winogrande.py
import os import argparse import ast import pickle import random import time import numpy as np import openai from sklearn.metrics import accuracy_score, f1_score from tqdm import tqdm import utils class Winogrande(): def __init__(self, templates): self.apply_template = templates def build_text_pr...
[ "PLACEHOLDERPLACEHOLDER\n\n", "'''\nThis is a coference resolution task. There will be a '_' in a given sentence and options will be provided. You need to choose from given options and fill in the '_'.\n'''\n\n", "None", "\n\n\n", "\n\nAnswer: " ]
2024-01-10
zharry29/curious_code_prompts
datasets~imdb~imdb.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") from scipy.stats...
[ "PLACEHOLDERPLACEHOLDER\n\n\n", "PLACEHOLDER PLACEHOLDER.\n\n", "Movie Expressed Sentiment" ]
2024-01-10
zharry29/curious_code_prompts
datasets~OpenPI-v2~code-prompts~class_prefix.py
import openai from utils import build_prompt class EntityStateGeneration(): '''function to generate entity state changes given the goal, context, and current step of a procedure. ''' def __init__(self): pass def gpt4(self, prompt): res = openai.Completion.create( e...
[]
2024-01-10
zharry29/curious_code_prompts
datasets~HotpotQA~hotpotqa.py
import time import json import utils import random import pickle import openai import argparse import numpy as np from tqdm import tqdm from datasets import load_dataset from sklearn.metrics import accuracy_score class HotpotQA(): def __init__(self, apply_template): self.apply_template = apply_template ...
[ "./code-prompts/comment_prefix.py", "PLACEHOLDERPLACEHOLDER\n\n", "None", "./code-prompts/class_prefix.py", "\n\n\n", "\n\nAnswer: " ]
2024-01-10
zharry29/curious_code_prompts
datasets~wikihow_temporal~wikihow_temporal.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import csv import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") impor...
[ "(a) ", "You are trying to placeholder. You need to do two things:\n(a) PLACEHOLDER\n(b) PLACEHOLDER\nThe first thing to do is", "(b) ", "PLACEHOLDER PLACEHOLDER\n\n", "PLACEHOLDERPLACEHOLDER\n\n\n" ]
2024-01-10
zharry29/curious_code_prompts
datasets~xsum~xsum.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from transformers import AutoTokenizer from tqdm import tqdm from rouge import FilesRouge parser = argparse.ArgumentParser() parser.add_argument('--prompt', requ...
[ "{highlights}", "PLACEHOLDERPLACEHOLDER PLACEHOLDER\n\n\n", "DOC_tldr", "PLACEHOLDERPLACEHOLDERPLACEHOLDER\n\n" ]
2024-01-10
zharry29/curious_code_prompts
datasets~mmlu~mmlu.py
import argparse import openai import os import numpy as np import pandas as pd import time from crop import crop choices = ["A", "B", "C", "D"] def softmax(x): z = x - max(x) numerator = np.exp(z) denominator = np.sum(numerator) softmax = numerator/denominator return softmax def format_subject(s...
[ "\n{}. {}", "PLACEHOLDERPLACEHOLDER", "\nAnswer:", "The following are multiple choice questions (with answers) about {}.\n\n", " {}\n\n" ]
2024-01-10
zharry29/curious_code_prompts
datasets~squad~squad.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from transformers import AutoTokenizer from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('--prompt', required=True, type=str, help='Ei...
[ "{context}", "{answer}", "PLACEHOLDERPLACEHOLDER PLACEHOLDER\n\n", "question", "PLACEHOLDERPLACEHOLDERPLACEHOLDER\n\n", "Questions with Context +unanswerable", "context", "{question}" ]
2024-01-10
zharry29/curious_code_prompts
datasets~wikihow_goal_step~wikihow_goal_step.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import csv import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") impor...
[ "Given an action: PLACEHOLDER\nWhat is the most likely goal of that action?\n(a) PLACEHOLDER\n(b) PLACEHOLDER\n(c) PLACEHOLDER\n(d) PLACEHOLDER\nThe most likely goal is: ", "PLACEHOLDER PLACEHOLDER\n\n", " ", "goalPLACEHOLDER", "PLACEHOLDERPLACEHOLDER\n\n\n" ]
2024-01-10
zharry29/curious_code_prompts
datasets~OpenPI-v2~openpi.py
import re import ast import json import time import utils import pickle import random import openai import argparse import numpy as np from tqdm import tqdm from datasets import load_dataset from sklearn.metrics import accuracy_score class OpenPI(): def __init__(self, metadata, apply_template): self.metad...
[ "./code-prompts/comment_prefix.py", "\n", "[]", "PLACEHOLDER\n\n", "- The PLACEHOLDER of PLACEHOLDER is PLACEHOLDER before and PLACEHOLDER afterwards.\n", "PLACEHOLDERPLACEHOLDER", "PLACEHOLDERGoal: PLACEHOLDER\n\n", "./code-prompts/class_prefix.py", "['P L A C E H O L D E R']", "Goal: PLACEHOLDER...
2024-01-10
zharry29/curious_code_prompts
datasets~HellaSWAG~hellaswag.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") import backoff ...
[ "PLACEHOLDER\n\nAnswer: PLACEHOLDER\n\n\n", "PLACEHOLDERPLACEHOLDER\n\n\n", "how_ends" ]
2024-01-10
zharry29/curious_code_prompts
datasets~yelp~yelp.py
import argparse import openai from datasets import load_dataset import random random.seed(29) from promptsource.templates import DatasetTemplates import time from sklearn.metrics import accuracy_score import pickle from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gpt2") from scipy.stats...
[ "yelp_review_full", "PLACEHOLDER PLACEHOLDER.\n\n", "PLACEHOLDERPLACEHOLDER\n\n\n", "based_on_that" ]
2024-01-10
zharry29/curious_code_prompts
datasets~ANLI~anli.py
import time import json import utils import pickle import random import openai import argparse import numpy as np from tqdm import tqdm from datasets import load_dataset from sklearn.metrics import accuracy_score random.seed(29) class ANLI(): def __init__(self, apply_template, idx): self.apply_template =...
[ "./code-prompts/comment_prefix.py", "PLACEHOLDERPLACEHOLDER\n\n", "None", "./code-prompts/class_prefix.py", "\n\n\n", "\n\nAnswer: " ]
2024-01-10
jitingxu1/llama_index
llama_index~evaluation~dataset_generation.py
"""Dataset generation from documents""" from __future__ import annotations import re from typing import List, Optional from llama_index import ( Document, SummaryIndex, ServiceContext, ) from llama_index.llms.openai import OpenAI from llama_index.prompts.base import BasePromptTemplate, PromptTemplate fro...
[ "Context information is below.\n\"\n\"\n---------------------\n{context_str}\n---------------------\n\"\n\"Given the context information and not prior knowledge.\n\"\n\"generate only questions based on the below query.\n\"\n\"{query_str}\n\"\n" ]
2024-01-10
yamyyao/langchain
libs~experimental~langchain_experimental~comprehend_moderation~pii.py
import asyncio from typing import Any, Dict, Optional from langchain_experimental.comprehend_moderation.base_moderation_exceptions import ( ModerationPiiError, ) class ComprehendPII: def __init__( self, client: Any, callback: Optional[Any] = None, unique_id: Optional[str] = No...
[]
2024-01-10
yamyyao/langchain
libs~langchain~langchain~vectorstores~elasticsearch.py
import logging import uuid from abc import ABC, abstractmethod from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Literal, Optional, Tuple, Union, ) import numpy as np from langchain.docstore.document import Document from langchain.schema.embeddings import...
[]
2024-01-10
yamyyao/langchain
libs~langchain~tests~integration_tests~vectorstores~test_xata.py
"""Test Xata vector store functionality. Before running this test, please create a Xata database by following the instructions from: https://python.langchain.com/docs/integrations/vectorstores/xata """ import os from langchain.docstore.document import Document from langchain.embeddings.openai import OpenAIEmbeddings...
[]
2024-01-10
yamyyao/langchain
libs~experimental~langchain_experimental~comprehend_moderation~toxicity.py
import asyncio import importlib from typing import Any, List, Optional from langchain_experimental.comprehend_moderation.base_moderation_exceptions import ( ModerationToxicityError, ) class ComprehendToxicity: def __init__( self, client: Any, callback: Optional[Any] = None, un...
[]
2024-01-10
yamyyao/langchain
libs~langchain~langchain~memory~readonly.py
from typing import Any, Dict, List from langchain.schema import BaseMemory class ReadOnlySharedMemory(BaseMemory): """A memory wrapper that is read-only and cannot be changed.""" memory: BaseMemory @property def memory_variables(self) -> List[str]: """Return memory variables.""" ret...
[]
2024-01-10
huqianghui/aigc-langchain-bot
common~bing_search_multi_market.py
"""Util that calls Bing Search. In order to set this up, follow instructions at: https://levelup.gitconnected.com/api-tutorial-how-to-use-bing-web-search-api-in-python-4165d5592a7e """ from typing import Dict, List import requests from langchain.utilities import BingSearchAPIWrapper class BingSearchAPIMultiMarketW...
[]
2024-01-10
aahn33/llm-summary
map_and_refine~refine.py
from langchain.chat_models import ChatOpenAI from langchain.docstore.document import Document from langchain.prompts import PromptTemplate from langchain.chains.summarize import load_summarize_chain from langchain.text_splitter import CharacterTextSplitter from langchain.callbacks import get_openai_callback import tikt...
[ "\n Your assignment is to expand an existing summary by adding new information that follows it. Here's the current summary up to a specified point:\n\n {existing}\n\n Now, consider the following content which occurs after the existing summary:\n\n {text}\n\n Evaluate the additiona...