date_collected stringclasses 1
value | repo_name stringlengths 6 116 | file_name stringlengths 2 220 | file_contents stringlengths 13 357k | prompts sequence |
|---|---|---|---|---|
2024-01-10 | SBrandeis/transformers | src~transformers~models~openai~modeling_tf_openai.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and 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 compliance with the License.
# You may obtain a copy of the License... | [] |
2024-01-10 | Lucete28/TradeTrend | TT_runfile~update_naver_raw.py | from airflow.models.variable import Variable
import openai
import pandas as pd
openai.api_key = Variable.get("gpt_api_key")
Target_list = Variable.get("Target_list")
values = [tuple(item.strip("()").split(",")) for item in Target_list.split("),")]
values = [(x[0].strip(), x[1].strip()) for x in values]
err_report =... | [
"PLACEHOLDER PLACEHOLDER 관련 뉴스기사 제목인데 PLACEHOLDER 주식에 미칠 긍정도의 평균을 0에서 1사이 소숫점 두자리까지 나타내 float값만"
] |
2024-01-10 | LilithHafner/ai | integrated_ai.py | import openai
openai.api_key = "sk-..."
# GPT AI
def ai(prompt):
response = openai.Completion.create(
engine="code-davinci-002",
prompt=prompt,
temperature=0,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
stop="<end>"
)
return response.cho... | [
"This is a question and answer bot that has oracles to various external tools including python, google, and others\n\n<user input>what time is it<end>\n<pyhton eval>time.ctime()<end>\n<python eval result>Traceback (most recent call last):\n File \"/Users/x/Documents/integrated_ai.py\", line 26, in python\n retu... |
2024-01-10 | Kororinpas/Lit_Tool | document_util.py | def get_split_documents(docs, chunk_size, chunk_overlap):
from langchain.text_splitter import RecursiveCharacterTextSplitter
text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size,chunk_overlap=chunk_overlap)
return text_splitter.split_documents(docs) | [] |
2024-01-10 | Kororinpas/Lit_Tool | literature_test.py | import streamlit as st
import sys
class StreamlitWriter:
def write(self, text):
st.write(text.strip())
### This the function about streamlit
def Vector_Databse():
st.write("Vector Database")
choose = st.radio("Choose using an existing database or upload a new one.",
["Using ... | [
"\n Given the document and query, find PLACEHOLDER sentences in the document that are most similar in meaning to the query. \n Return the sentences, the meta source of the sentences and the cosine similarity scores. \n If no similar sentences is found, return the sentence with highest cosine siliarity scor... |
2024-01-10 | Kororinpas/Lit_Tool | pdf_retrieval.py | from operator import itemgetter
from langchain.chat_models import ChatOpenAI
from langchain.output_parsers import StructuredOutputParser, ResponseSchema
from langchain.prompts import ChatPromptTemplate, HumanMessagePromptTemplate
from langchain.document_loaders import DataFrameLoader, PyMuPDFLoader
import os
import f... | [
"sample_introes",
"words_limit",
"format_instructions",
"\n I have extracted text from the initial pages of a Journal of Economic Literature (JEL) PDF file. I require assistance in extracting \n specific details, namely: article title, author, abstract and keywords section. Pleas... |
2024-01-10 | Kororinpas/Lit_Tool | pdf_documents.py | from pdf_metadata import get_pdf_metadata
from pdf_metadata_llm import get_pdf_metadata_using_llm
def get_pdf_documents(pdf_files):
from langchain.document_loaders import PyMuPDFLoader,DirectoryLoader,UnstructuredPDFLoader
docs =[]
import re
for pdf_fullpath in pdf_files:
metadata = get_pdf_metadata(pdf... | [] |
2024-01-10 | Kororinpas/Lit_Tool | pdf_metadata_llm.py | from doi import get_doi
from document_util import get_split_documents
def get_pdf_metadata_using_llm(doc):
import re
doc[0].page_content = re.sub('\n+',' ',doc[0].page_content.strip())
# from langchain.text_splitter import RecursiveCharacterTextSplitter
# text_splitter = RecursiveCharacterTextSplitter(... | [] |
2024-01-10 | Kororinpas/Lit_Tool | cosine_match.py | def search_cosine_similarity(query,split_docs,embeddings): ##query-str,split_docs-list,embeddings-embeddings()
split_docs_content = [content['content'] for content in split_docs]
embed_docs = embeddings.embed_documents(split_docs_content)
embed_query= embeddings.embed_query(query)
from openai.embe... | [] |
2024-01-10 | Kororinpas/Lit_Tool | embedding_function.py | def get_embedding_function():
from langchain.embeddings import HuggingFaceEmbeddings
import torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model_name = "sentence-transformers/all-mpnet-base-v2"
model_kwargs = {'device':device}
return HuggingFaceEmbeddings(model_name=model_name... | [] |
2024-01-10 | Kororinpas/Lit_Tool | doi.py | def get_doi(abstract):
from kor.extraction import create_extraction_chain
from kor.nodes import Object, Text, Number
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0) # type: ignore
schema = Object(
id="doi",
description="doi is a digital ide... | [] |
2024-01-10 | jied-O/Jids-Garage | langchainagentstest.py | from langchain import OpenAI
from langchain.chains import LLMChain
from langchain.chains import PALChain
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from langchain.agents import load_tools
from ogbujipt.config import openai_emulation
from ogbujipt.model_style.alpaca import prep... | [
"What is the capital of {place}?"
] |
2024-01-10 | tarunsamanta2k20/quivr | backend~parsers~audio.py | import os
import tempfile
import time
from io import BytesIO
from tempfile import NamedTemporaryFile
import openai
from fastapi import UploadFile
from langchain.document_loaders import TextLoader
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.schema import Document
from langchain.text_splitter... | [] |
2024-01-10 | sshh12/llm_optimize | llm_optimize~optimize.py | from typing import Callable, Optional, Tuple, List
import re
import openai
from langchain.input import print_text
from langchain.prompts.chat import (
SystemMessage,
HumanMessage,
AIMessage,
)
from llm_optimize import llm, constants
# The numeric score and the LLM-facing representation
ScoreTuple = Tuple... | [] |
2024-01-10 | xiahan4956/Auto_Claude_100k | autogpt~llm~api_manager.py | from __future__ import annotations
from typing import List, Optional
import openai
from openai import Model
from autogpt.config import Config
from autogpt.llm.base import CompletionModelInfo, MessageDict
from autogpt.llm.providers.openai import OPEN_AI_MODELS
from autogpt.logs import logger
from autogpt.singleton im... | [] |
2024-01-10 | xiahan4956/Auto_Claude_100k | autogpt~llm~utils~claude.py | from autogpt.config import Config
import time
import openai
import json
CFG = Config()
openai.api_key = CFG.openai_api_key
MAX_TOKEN_ONCE = 100000
CONTINUE_PROMPT = "... continue"
from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
def _sendReq(anthropic, prompt, max_tokens_to_sample):
print("----------... | [
"f\"{question} {anthropic.AI_PROMPT}",
"1. You will receive a JSON string, and your task is to extract information from it and return it as a JSON object. 2.Use function's json schema to extrct.Please notice the format 3. Be aware that the given JSON may contain errors, so you may need to infer the fields and t... |
2024-01-10 | pkrack/asp | asp~ppo_patched.py | import warnings
from typing import Any, Dict, Optional, Type, TypeVar, Union
import numpy as np
import torch as th
from gymnasium import spaces
from stable_baselines3.common.on_policy_algorithm import OnPolicyAlgorithm
from stable_baselines3.common.policies import ActorCriticCnnPolicy, ActorCriticPolicy, BasePolicy, M... | [] |
2024-01-10 | jongio/chat-with-your-data-solution-accelerator | backend~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 | jongio/chat-with-your-data-solution-accelerator | backend~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 | jongio/chat-with-your-data-solution-accelerator | backend~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 | pcc2k00/HousingPriceTrend | HousingPriceTrendMetaphor.py | import openai
import yaml
from metaphor_python import Metaphor
with open("pass.yml") as f:
content = f.read()
my_credentials = yaml.load(content, Loader=yaml.FullLoader)
openai.api_key = my_credentials["openAi"]
metaphor = Metaphor(my_credentials["metaphor"])
USER_QUESTION = "Recent housing price in Seattle"
... | [] |
2024-01-10 | romain-cambonie/openxcom-mod-generator | src~chat~ask_for_visual_proposition.py | from openai import OpenAI
from openai.types.chat import ChatCompletion
def ask_for_concept_art(
client: OpenAI,
character_story: str,
art_style_description: str,
) -> str:
system_prompt = (
"Generate a comprehensive and vivid visual concept art of a character for a piece of artwork. "
... | [
"Generate a comprehensive and vivid visual concept art of a character for a piece of artwork. The character should fit within a distinct theme and style, and the description must be detailed enough to guide an artist in creating a dynamic and engaging image.Here are the guidelines for your description:Theme and Set... |
2024-01-10 | romain-cambonie/openxcom-mod-generator | src~dalle~call_dalle_and_save_image.py | import requests
from openai import OpenAI
from pathlib import Path
from typing import Optional
from openai.types import ImagesResponse
def call_dalle_and_save_image(prompt: str, client: OpenAI, output_file_path: Path) -> Optional[Path]:
try:
# Generate image using OpenAI client
response: ImagesRe... | [] |
2024-01-10 | romain-cambonie/openxcom-mod-generator | src~chat~ask_for_dalle_character_prompt.py | from openai import OpenAI
from openai.types.chat import ChatCompletion
def ask_for_dalle_character_prompt(
client: OpenAI,
concept_art_description: str,
) -> str:
system_prompt = (
"You're given a detailed concept art description of a character. Your task is to condense this description into a "
... | [
"Transform the above concept art description into a succinct DALL-E prompt.",
"You're given a detailed concept art description of a character. Your task is to condense this description into a succinct, vivid DALL-E prompt.The DALL-E prompt should accurately capture the key visual elements and artistic style descr... |
2024-01-10 | romain-cambonie/openxcom-mod-generator | src~chat~ask_for_origin_story.py | from openai import OpenAI
from openai.types.chat import ChatCompletion
def ask_for_origin_story(
client: OpenAI,
character_name: str,
equipment_description: str,
appearance_description: str,
) -> str:
system_prompt = (
"You are tasked with creating a short origin story for a fictional char... | [
"You are tasked with creating a short origin story for a fictional character. You will receive three key pieces of information: (1) the character's name, (2) a YAML payload detailing the character's equipment, and (3) an image that shows some characteristics of the character's appearance. Your job is to weave these... |
2024-01-10 | outlines-dev/outlines | outlines~models~__init__.py | """Module that contains all the models integrated in outlines.
We group the models in submodules by provider instead of theme (completion, chat
completion, diffusers, etc.) and use routing functions everywhere else in the
codebase.
"""
from .awq import awq
from .exllamav2 import exl2
from .gptq import gptq
from .llam... | [] |
2024-01-10 | ball2004244/Pinecone-Hackathon-23-Backend | logic~pinecone_db.py | '''
This file contains the logic for storing and querying data from Pinecone.
'''
from typing import List
from langchain.vectorstores import Pinecone
from langchain.chains.summarize import load_summarize_chain
from langchain.llms import GooglePalm
from langchain.embeddings.google_palm import GooglePalmEmbeddings
from l... | [] |
2024-01-10 | TheoKanning/crossword | crossword~clues.py | import json
import os
import openai
def convert_raw_clues(raw_filename, output_filename):
"""
Reads raw clue info from raw_filename, formats it to match GPT-3's fine-tune input, and writes it to output_filename
Raw clues are formatted like "Up in the air : ALOFT"
"""
with open(output_filename, ... | [
"f\"Answer: {answer.lower()}\\nClue:"
] |
2024-01-10 | NusretOzates/langchain_retrieval_qa_bot | data_loaders.py | import re
from itertools import chain
from typing import List
from langchain.docstore.document import Document
from langchain.document_loaders import PyPDFLoader, TextLoader, UnstructuredURLLoader
from langchain.indexes import VectorstoreIndexCreator
from langchain.text_splitter import RecursiveCharacterTextSplitter
f... | [] |
2024-01-10 | Antrozhuk/telegramChatGPTBot | src~telegram_bot.py | import telegram.constants as constants
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, MessageHandler, filters
from src.openai_helper import OpenAIHelper
from src.logger import Logger
class ChatGPT3TelegramBot:
"""
Class representing a Chat-GPT3 Telegram... | [] |
2024-01-10 | aws-samples/aurora-postgresql-pgvector | DAT303~02_QuestionAndAnswering~rag_app.py | # Import libraries
from dotenv import load_dotenv
from PyPDF2 import PdfReader
from langchain.vectorstores.pgvector import PGVector
from langchain.memory import ConversationSummaryBufferMemory
from langchain.chains import ConversationalRetrievalChain
from htmlTemplates import css
from langchain.text_splitter import Rec... | [] |
2024-01-10 | WuQingYi20/InteractiveStory | wsgi.py | from flask import Flask, render_template, jsonify, request
import openai
import re
from prompts import prompts
from dotenv import load_dotenv
import os
# Load the .env file
load_dotenv()
app = Flask(__name__)
initialCall = True
currentDescription = ""
# Initialize OpenAI API with your API key
openai.api_key = os.g... | [
"\n",
"PLACEHOLDER PLACEHOLDER",
"PLACEHOLDER",
"originalStory + \"\\n\" + prompts['next-page']['story']",
"next-page",
"originalStory + \"\\n\" + prompts['next-page']['summary']",
"originalStory + response_story.choices[0].message['content'] + \"\\n\" + prompts['next-page']['choices']",
"content",
... |
2024-01-10 | yamdereneko/ymbot | src~chatGPT~Chat_GPT_API.py | # -*- coding: utf-8 -*-
import asyncio
import nonebot
from pydantic import BaseModel
from httpx import AsyncClient
import src.Data.jx3_Redis as redis
import openai
class Response(BaseModel):
"""返回数据模型"""
id: str
"""状态码"""
object: str
created: int
model: str
choices: list
"""返回消息字符串""... | [] |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 48