Google, Duckduckgo, Phind.com, Access AI Models, YouTube 비디오를 전사하고, 임시 이메일 및 전화 번호를 생성하고, 텍스트 음성 연사를 활용하고, WebAI (터미널 GPT 및 오픈 통역사)를 활용하고 오프라인 LLM을 탐색하는 등 무엇이든 검색하십시오!
rawdog 기능을 사용하여 터미널 내에서 직접 파이썬 스크립트를 실행하십시오. pip install - U webscout python - m webscout - - help| 명령 | 설명 |
|---|---|
| Python -M WebScout 답변 -K 텍스트 | CLI 기능 WebScout을 사용하여 답변 검색을 수행합니다. |
| Python -M WebScout 이미지 -K 텍스트 | CLI 기능 WebScout을 사용하여 이미지 검색을 수행합니다. |
| Python -m Webscout Maps -k 텍스트 | CLI 기능 WebScout을 사용하여 맵 검색을 수행합니다. |
| Python -M Webscout News -K 텍스트 | CLI 기능 WebScout을 사용하여 뉴스 검색을 수행합니다. |
| Python -M WebScout 제안 -K 텍스트 | CLI 기능 제안 검색을 수행하여 WebScout을 사용합니다. |
| Python -M WebScout 텍스트 -K 텍스트 | CLI 기능 WebScout을 사용하여 텍스트 검색을 수행합니다. |
| Python -m WebScout 번역 -K 텍스트 | CLI 기능을 수행하는 WebScout을 사용하여 번역. |
| Python -M Webscout 버전 | 프로그램 버전을 인쇄하고 반환하는 명령 줄 인터페이스 명령. |
| Python -M Webscout 비디오 -K 텍스트 | CLI 기능 Duckduckgo API를 사용하여 비디오 검색을 수행합니다. |
위로 가십시오
xa-ar for Arabia
xa-en for Arabia (en)
ar-es for Argentina
au-en for Australia
at-de for Austria
be-fr for Belgium (fr)
be-nl for Belgium (nl)
br-pt for Brazil
bg-bg for Bulgaria
ca-en for Canada
ca-fr for Canada (fr)
ct-ca for Catalan
cl-es for Chile
cn-zh for China
co-es for Colombia
hr-hr for Croatia
cz-cs for Czech Republic
dk-da for Denmark
ee-et for Estonia
fi-fi for Finland
fr-fr for France
de-de for Germany
gr-el for Greece
hk-tzh for Hong Kong
hu-hu for Hungary
in-en for India
id-id for Indonesia
id-en for Indonesia (en)
ie-en for Ireland
il-he for Israel
it-it for Italy
jp-jp for Japan
kr-kr for Korea
lv-lv for Latvia
lt-lt for Lithuania
xl-es for Latin America
my-ms for Malaysia
my-en for Malaysia (en)
mx-es for Mexico
nl-nl for Netherlands
nz-en for New Zealand
no-no for Norway
pe-es for Peru
ph-en for Philippines
ph-tl for Philippines (tl)
pl-pl for Poland
pt-pt for Portugal
ro-ro for Romania
ru-ru for Russia
sg-en for Singapore
sk-sk for Slovak Republic
sl-sl for Slovenia
za-en for South Africa
es-es for Spain
se-sv for Sweden
ch-de for Switzerland (de)
ch-fr for Switzerland (fr)
ch-it for Switzerland (it)
tw-tzh for Taiwan
th-th for Thailand
tr-tr for Turkey
ua-uk for Ukraine
uk-en for United Kingdom
us-en for United States
ue-es for United States (es)
ve-es for Venezuela
vn-vi for Vietnam
wt-wt for No region
위로 가십시오
from os import rename , getcwd
from webscout import YTdownloader
def download_audio ( video_id ):
youtube_link = video_id
handler = YTdownloader . Handler ( query = youtube_link )
for third_query_data in handler . run ( format = 'mp3' , quality = '128kbps' , limit = 1 ):
audio_path = handler . save ( third_query_data , dir = getcwd ())
rename ( audio_path , "audio.mp3" )
def download_video ( video_id ):
youtube_link = video_id
handler = YTdownloader . Handler ( query = youtube_link )
for third_query_data in handler . run ( format = 'mp4' , quality = 'auto' , limit = 1 ):
video_path = handler . save ( third_query_data , dir = getcwd ())
rename ( video_path , "video.mp4" )
if __name__ == "__main__" :
# download_audio("https://www.youtube.com/watch?v=c0tMvzB0OKw")
download_video ( "https://www.youtube.com/watch?v=c0tMvzB0OKw" ) from webscout import weather as w
weather = w . get ( "Qazigund" )
w . print_weather ( weather ) from webscout import weather_ascii as w
weather = w . get ( "Qazigund" )
print ( weather ) import json
import asyncio
from webscout import VNEngine
from webscout import TempMail
async def main ():
vn = VNEngine ()
countries = vn . get_online_countries ()
if countries :
country = countries [ 0 ][ 'country' ]
numbers = vn . get_country_numbers ( country )
if numbers :
number = numbers [ 0 ][ 'full_number' ]
inbox = vn . get_number_inbox ( country , number )
# Serialize inbox data to JSON string
json_data = json . dumps ( inbox , ensure_ascii = False , indent = 4 )
# Print with UTF-8 encoding
print ( json_data )
async with TempMail () as client :
domains = await client . get_domains ()
print ( "Available Domains:" , domains )
email_response = await client . create_email ( alias = "testuser" )
print ( "Created Email:" , email_response )
messages = await client . get_messages ( email_response . email )
print ( "Messages:" , messages )
await client . delete_email ( email_response . email , email_response . token )
print ( "Email Deleted" )
if __name__ == "__main__" :
asyncio . run ( main ()) WebScout의 transcriber 기능은 YouTube 비디오를 전사하는 편리한 도구입니다.
예:
from webscout import YTTranscriber
yt = YTTranscriber ()
from rich import print
video_url = input ( "Enter the YouTube video URL: " )
transcript = yt . get_transcript ( video_url , languages = None )
print ( transcript ) from webscout import GoogleS
from rich import print
searcher = GoogleS ()
results = searcher . search ( "HelpingAI-9B" , max_results = 20 , extract_text = False , max_text_length = 200 )
for result in results :
print ( result ) from webscout import BingS
from rich import print
searcher = BingS ()
results = searcher . search ( "HelpingAI-9B" , max_results = 20 , extract_webpage_text = True , max_extract_characters = 1000 )
for result in results :
print ( result ) WEBS and AsyncWEBS 클래스는 Duckduckgo.com에서 검색 결과를 검색하는 데 사용됩니다.
AsyncWEBS 클래스를 사용하려면 Python의 asyncio 라이브러리를 사용하여 비동기 작업을 수행 할 수 있습니다.
WEBS 또는 AsyncWEBS 클래스의 인스턴스를 초기화하려면 다음 선택 사항을 제공 할 수 있습니다.
예 - 웹 :
from webscout import WEBS
R = WEBS (). text ( "python programming" , max_results = 5 )
print ( R )예 - 비동기Webs :
import asyncio
import logging
import sys
from itertools import chain
from random import shuffle
import requests
from webscout import AsyncWEBS
# If you have proxies, define them here
proxies = None
if sys . platform . lower (). startswith ( "win" ):
asyncio . set_event_loop_policy ( asyncio . WindowsSelectorEventLoopPolicy ())
def get_words ():
word_site = "https://www.mit.edu/~ecprice/wordlist.10000"
resp = requests . get ( word_site )
words = resp . text . splitlines ()
return words
async def aget_results ( word ):
async with AsyncWEBS ( proxies = proxies ) as WEBS :
results = await WEBS . text ( word , max_results = None )
return results
async def main ():
words = get_words ()
shuffle ( words )
tasks = [ aget_results ( word ) for word in words [: 10 ]]
results = await asyncio . gather ( * tasks )
print ( f"Done" )
for r in chain . from_iterable ( results ):
print ( r )
logging . basicConfig ( level = logging . DEBUG )
await main () 중요 참고 : WEBS 및 AsyncWEBS 클래스는 항상 컨텍스트 관리자로 사용해야합니다 (문과). Context Manager가 HTTP 클라이언트 연결을 자동으로 처리하고 닫을 수 있으므로 적절한 리소스 관리 및 정리를 보장합니다.
예외 :
WebscoutE : API 요청 중에 일반적인 예외가있을 때 제기되었습니다. text() - Duckduckgo.com의 텍스트 검색 from webscout import WEBS
# Text search for 'live free or die' using DuckDuckGo.com
with WEBS () as WEBS :
for r in WEBS . text ( 'live free or die' , region = 'wt-wt' , safesearch = 'off' , timelimit = 'y' , max_results = 10 ):
print ( r )
for r in WEBS . text ( 'live free or die' , region = 'wt-wt' , safesearch = 'off' , timelimit = 'y' , max_results = 10 ):
print ( r )answers() - DuckDuckgo.com의 즉각적인 답변 from webscout import WEBS
# Instant answers for the query "sun" using DuckDuckGo.com
with WEBS () as WEBS :
for r in WEBS . answers ( "sun" ):
print ( r )images() - Duckduckgo.com의 이미지 검색 from webscout import WEBS
# Image search for the keyword 'butterfly' using DuckDuckGo.com
with WEBS () as WEBS :
keywords = 'butterfly'
WEBS_images_gen = WEBS . images (
keywords ,
region = "wt-wt" ,
safesearch = "off" ,
size = None ,
type_image = None ,
layout = None ,
license_image = None ,
max_results = 10 ,
)
for r in WEBS_images_gen :
print ( r )videos() - Duckduckgo.com의 비디오 검색 from webscout import WEBS
# Video search for the keyword 'tesla' using DuckDuckGo.com
with WEBS () as WEBS :
keywords = 'tesla'
WEBS_videos_gen = WEBS . videos (
keywords ,
region = "wt-wt" ,
safesearch = "off" ,
timelimit = "w" ,
resolution = "high" ,
duration = "medium" ,
max_results = 10 ,
)
for r in WEBS_videos_gen :
print ( r )news() - Duckduckgo.com의 뉴스 검색 from webscout import WEBS
import datetime
def fetch_news ( keywords , timelimit ):
news_list = []
with WEBS () as webs_instance :
WEBS_news_gen = webs_instance . news (
keywords ,
region = "wt-wt" ,
safesearch = "off" ,
timelimit = timelimit ,
max_results = 20
)
for r in WEBS_news_gen :
# Convert the date to a human-readable format using datetime
r [ 'date' ] = datetime . datetime . fromisoformat ( r [ 'date' ]). strftime ( '%B %d, %Y' )
news_list . append ( r )
return news_list
def _format_headlines ( news_list , max_headlines : int = 100 ):
headlines = []
for idx , news_item in enumerate ( news_list ):
if idx >= max_headlines :
break
new_headline = f" { idx + 1 } . { news_item [ 'title' ]. strip () } "
new_headline += f"(URL: { news_item [ 'url' ]. strip () } ) "
new_headline += f" { news_item [ 'body' ]. strip () } "
new_headline += " n "
headlines . append ( new_headline )
headlines = " n " . join ( headlines )
return headlines
# Example usage
keywords = 'latest AI news'
timelimit = 'd'
news_list = fetch_news ( keywords , timelimit )
# Format and print the headlines
formatted_headlines = _format_headlines ( news_list )
print ( formatted_headlines )maps() - Duckduckgo.com의지도 검색 from webscout import WEBS
# Map search for the keyword 'school' in 'anantnag' using DuckDuckGo.com
with WEBS () as WEBS :
for r in WEBS . maps ( "school" , place = "anantnag" , max_results = 50 ):
print ( r )translate() - 번역 from webscout import WEBS
# Translation of the keyword 'school' to German ('hi') using DuckDuckGo.com
with WEBS () as WEBS :
keywords = 'school'
r = WEBS . translate ( keywords , to = "hi" )
print ( r )suggestions() - DuckDuckgo.com의 제안 from webscout import WEBS
# Suggestions for the keyword 'fly' using DuckDuckGo.com
with WEBS () as WEBS :
for r in WEBS . suggestions ( "fly" ):
print ( r )position 면접관language 문학 비평가 참고 : 일부 "Acts"는 프롬프트를 사용할 때 특정 값으로 대체 해야하는 position 또는 language 와 같은 자리 표시자를 사용합니다.
모든 TTI 제공 업체에는 동일한 사용 코드가 있으므로 가져 오기 만 변경하면됩니다.
from webscout import DeepInfraImager
bot = DeepInfraImager ()
resp = bot . generate ( "AI-generated image - webscout" , 1 )
print ( bot . save ( resp )) from webscout import Voicepods
voicepods = Voicepods ()
text = "Hello, this is a test of the Voicepods text-to-speech"
print ( "Generating audio..." )
audio_file = voicepods . tts ( text )
print ( "Playing audio..." )
voicepods . play_audio ( audio_file )Duckchat LLM과 채팅 from webscout import WEBS as w
R = w (). chat ( "Who are you" , model = 'gpt-4o-mini' ) # mixtral-8x7b, llama-3.1-70b, claude-3-haiku, gpt-4o-mini
print ( R )PhindSearch phind.com을 사용하여 검색 from webscout import PhindSearch
# Create an instance of the PHIND class
ph = PhindSearch ()
# Define a prompt to send to the AI
prompt = "write a essay on phind"
# Use the 'ask' method to send the prompt and receive a response
response = ph . ask ( prompt )
# Extract and print the message from the response
message = ph . get_message ( response )
print ( message )Phindv2 사용 :
from webscout import Phindv2
# Create an instance of the PHIND class
ph = Phindv2 ()
# Define a prompt to send to the AI
prompt = ""
# Use the 'ask' method to send the prompt and receive a response
response = ph . ask ( prompt )
# Extract and print the message from the response
message = ph . get_message ( response )
print ( message )Gemini Google Gemini와 검색 import webscout
from webscout import GEMINI
from rich import print
COOKIE_FILE = "cookies.json"
# Optional: Provide proxy details if needed
PROXIES = {}
# Initialize GEMINI with cookie file and optional proxies
gemini = GEMINI ( cookie_file = COOKIE_FILE , proxy = PROXIES )
# Ask a question and print the response
response = gemini . chat ( "websearch about HelpingAI and who is its developer" )
print ( response )YEPCHAT from webscout import YEPCHAT
ai = YEPCHAT ( Tools = False )
response = ai . chat ( input ( ">>> " ))
for chunk in response :
print ( chunk , end = "" , flush = True )
#---------------Tool Call-------------
from rich import print
from webscout import YEPCHAT
def get_current_time ():
import datetime
return f"The current time is { datetime . datetime . now (). strftime ( '%H:%M:%S' ) } "
def get_weather ( location : str ) -> str :
return f"The weather in { location } is sunny."
ai = YEPCHAT ( Tools = True ) # Set Tools=True to use tools in the chat.
ai . tool_registry . register_tool ( "get_current_time" , get_current_time , "Gets the current time." )
ai . tool_registry . register_tool (
"get_weather" ,
get_weather ,
"Gets the weather for a given location." ,
parameters = {
"type" : "object" ,
"properties" : {
"location" : { "type" : "string" , "description" : "The city and state, or zip code" }
},
"required" : [ "location" ],
},
)
response = ai . chat ( input ( ">>> " ))
for chunk in response :
print ( chunk , end = "" , flush = True )BlackBox 블랙 박스와 검색/채팅 from webscout import BLACKBOXAI
from rich import print
ai = BLACKBOXAI (
is_conversation = True ,
max_tokens = 800 ,
timeout = 30 ,
intro = None ,
filepath = None ,
update_file = True ,
proxies = {},
history_offset = 10250 ,
act = None ,
model = None # You can specify a model if needed
)
# Start an infinite loop for continuous interaction
while True :
# Define a prompt to send to the AI
prompt = input ( "Enter your prompt: " )
# Check if the user wants to exit the loop
if prompt . lower () == "exit" :
break
# Use the 'chat' method to send the prompt and receive a response
r = ai . chat ( prompt )
print ( r )PERPLEXITY 당황 스러움으로 검색하십시오 from webscout import Perplexity
from rich import print
perplexity = Perplexity ()
# Stream the response
response = perplexity . chat ( input ( ">>> " ))
for chunk in response :
print ( chunk , end = "" , flush = True )
perplexity . close ()Meta AI 메타 AI와 채팅 from webscout import Meta
from rich import print
# **For unauthenticated usage**
meta_ai = Meta ()
# Simple text prompt
response = meta_ai . chat ( "What is the capital of France?" )
print ( response )
# Streaming response
for chunk in meta_ai . chat ( "Tell me a story about a cat." ):
print ( chunk , end = "" , flush = True )
# **For authenticated usage (including image generation)**
fb_email = "[email protected]"
fb_password = "qwertfdsa"
meta_ai = Meta ( fb_email = fb_email , fb_password = fb_password )
# Text prompt with web search
response = meta_ai . ask ( "what is currently happning in bangladesh in aug 2024" )
print ( response [ "message" ]) # Access the text message
print ( "Sources:" , response [ "sources" ]) # Access sources (if ```python
any )
# Image generation
response = meta_ai . ask ( "Create an image of a cat wearing a hat." )
print ( response [ "message" ]) # Print the text message from the response
for media in response [ "media" ]:
print ( media [ "url" ]) # Access image URLsKOBOLDAI from webscout import KOBOLDAI
# Instantiate the KOBOLDAI class with default parameters
koboldai = KOBOLDAI ()
# Define a prompt to send to the AI
prompt = "What is the capital of France?"
# Use the 'ask' method to get a response from the AI
response = koboldai . ask ( prompt )
# Extract and print the message from the response
message = koboldai . get_message ( response )
print ( message )Reka reka와 채팅 from webscout import REKA
a = REKA ( is_conversation = True , max_tokens = 8000 , timeout = 30 , api_key = "" )
prompt = "tell me about india"
response_str = a . chat ( prompt )
print ( response_str )Cohere Cohere와 채팅 from webscout import Cohere
a = Cohere ( is_conversation = True , max_tokens = 8000 , timeout = 30 , api_key = "" )
prompt = "tell me about india"
response_str = a . chat ( prompt )
print ( response_str )DeepSeek Deepseek과 채팅 from webscout import DeepSeek
from rich import print
ai = DeepSeek (
is_conversation = True ,
api_key = 'cookie' ,
max_tokens = 800 ,
timeout = 30 ,
intro = None ,
filepath = None ,
update_file = True ,
proxies = {},
history_offset = 10250 ,
act = None ,
model = "deepseek_chat"
)
# Define a prompt to send to the AI
prompt = "Tell me about india"
# Use the 'chat' method to send the prompt and receive a response
r = ai . chat ( prompt )
print ( r )Deepinfra from webscout import DeepInfra
ai = DeepInfra (
is_conversation = True ,
model = "Qwen/Qwen2-72B-Instruct" ,
max_tokens = 800 ,
timeout = 30 ,
intro = None ,
filepath = None ,
update_file = True ,
proxies = {},
history_offset = 10250 ,
act = None ,
)
prompt = "what is meaning of life"
response = ai . ask ( prompt )
# Extract and print the message from the response
message = ai . get_message ( response )
print ( message )GROQ from webscout import GROQ
ai = GROQ ( api_key = "" )
response = ai . chat ( "What is the meaning of life?" )
print ( response )
#----------------------TOOL CALL------------------
from webscout import GROQ # Adjust import based on your project structure
from webscout import WEBS
import json
# Initialize the GROQ client
client = GROQ ( api_key = "" )
MODEL = 'llama3-groq-70b-8192-tool-use-preview'
# Function to evaluate a mathematical expression
def calculate ( expression ):
"""Evaluate a mathematical expression"""
try :
result = eval ( expression )
return json . dumps ({ "result" : result })
except Exception as e :
return json . dumps ({ "error" : str ( e )})
# Function to perform a text search using DuckDuckGo.com
def search ( query ):
"""Perform a text search using DuckDuckGo.com"""
try :
results = WEBS (). text ( query , max_results = 5 )
return json . dumps ({ "results" : results })
except Exception as e :
return json . dumps ({ "error" : str ( e )})
# Add the functions to the provider
client . add_function ( "calculate" , calculate )
client . add_function ( "search" , search )
# Define the tools
tools = [
{
"type" : "function" ,
"function" : {
"name" : "calculate" ,
"description" : "Evaluate a mathematical expression" ,
"parameters" : {
"type" : "object" ,
"properties" : {
"expression" : {
"type" : "string" ,
"description" : "The mathematical expression to evaluate" ,
}
},
"required" : [ "expression" ],
},
}
},
{
"type" : "function" ,
"function" : {
"name" : "search" ,
"description" : "Perform a text search using DuckDuckGo.com and Yep.com" ,
"parameters" : {
"type" : "object" ,
"properties" : {
"query" : {
"type" : "string" ,
"description" : "The search query to execute" ,
}
},
"required" : [ "query" ],
},
}
}
]
user_prompt_calculate = "What is 25 * 4 + 10?"
response_calculate = client . chat ( user_prompt_calculate , tools = tools )
print ( response_calculate )
user_prompt_search = "Find information on HelpingAI and who is its developer"
response_search = client . chat ( user_prompt_search , tools = tools )
print ( response_search )LLama 70b 메타의 LLAMA 3 70B와 채팅 from webscout import LLAMA
llama = LLAMA ()
r = llama . chat ( "What is the meaning of life?" )
print ( r )AndiSearch from webscout import AndiSearch
a = AndiSearch ()
print ( a . chat ( "HelpingAI-9B" )) import json
import logging
from webscout import Julius , WEBS
from webscout . Agents . functioncall import FunctionCallingAgent
from rich import print
class FunctionExecutor :
def __init__ ( self , llama ):
self . llama = llama
def execute_web_search ( self , arguments ):
query = arguments . get ( "query" )
if not query :
return "Please provide a search query."
with WEBS () as webs :
search_results = webs . text ( query , max_results = 5 )
prompt = (
f"Based on the following search results: n n { search_results } n n "
f"Question: { query } n n "
"Please provide a comprehensive answer to the question based on the search results above. "
"Include relevant webpage URLs in your answer when appropriate. "
"If the search results don't contain relevant information, please state that and provide the best answer you can based on your general knowledge."
)
return self . llama . chat ( prompt )
def execute_general_ai ( self , arguments ):
question = arguments . get ( "question" )
if not question :
return "Please provide a question."
return self . llama . chat ( question )
def execute_UserDetail ( self , arguments ):
name = arguments . get ( "name" )
age = arguments . get ( "age" )
return f"User details - Name: { name } , Age: { age } "
def main ():
tools = [
{
"type" : "function" ,
"function" : {
"name" : "UserDetail" ,
"parameters" : {
"type" : "object" ,
"properties" : {
"name" : { "title" : "Name" , "type" : "string" },
"age" : { "title" : "Age" , "type" : "integer" }
},
"required" : [ "name" , "age" ]
}
}
},
{
"type" : "function" ,
"function" : {
"name" : "web_search" ,
"description" : "Search the web for information using Google Search." ,
"parameters" : {
"type" : "object" ,
"properties" : {
"query" : {
"type" : "string" ,
"description" : "The search query to be executed."
}
},
"required" : [ "query" ]
}
}
},
{
"type" : "function" ,
"function" : {
"name" : "general_ai" ,
"description" : "Use general AI knowledge to answer the question" ,
"parameters" : {
"type" : "object" ,
"properties" : {
"question" : { "type" : "string" , "description" : "The question to answer" }
},
"required" : [ "question" ]
}
}
}
]
agent = FunctionCallingAgent ( tools = tools )
llama = Julius ()
function_executor = FunctionExecutor ( llama )
user_input = input ( ">>> " )
function_call_data = agent . function_call_handler ( user_input )
print ( f"Function Call Data: { function_call_data } " )
try :
if "error" not in function_call_data :
function_name = function_call_data . get ( "tool_name" )
arguments = function_call_data . get ( "tool_input" , {})
execute_function = getattr ( function_executor , f"execute_ { function_name } " , None )
if execute_function :
result = execute_function ( arguments )
print ( "Function Execution Result:" )
for c in result :
print ( c , end = "" , flush = True )
else :
print ( f"Unknown function: { function_name } " )
else :
print ( f"Error: { function_call_data [ 'error' ] } " )
except Exception as e :
print ( f"An error occurred: { str ( e ) } " )
if __name__ == "__main__" :
main ()코드는 다른 공급자와 유사합니다.
LLM from webscout . LLM import LLM
# Read the system message from the file
with open ( 'system.txt' , 'r' ) as file :
system_message = file . read ()
# Initialize the LLM class with the model name and system message
llm = LLM ( model = "microsoft/WizardLM-2-8x22B" , system_message = system_message )
while True :
# Get the user input
user_input = input ( "User: " )
# Define the messages to be sent
messages = [
{ "role" : "user" , "content" : user_input }
]
# Use the mistral_chat method to get the response
response = llm . chat ( messages )
# Print the response
print ( "AI: " , response )WebScout은 이제 GGUF 모델을 로컬로 실행할 수 있습니다. 최소한의 구성으로 좋아하는 모델을 다운로드하여 실행할 수 있습니다.
예:
from webscout . Local import *
model_path = download_model ( "Qwen/Qwen2.5-0.5B-Instruct-GGUF" , "qwen2.5-0.5b-instruct-q2_k.gguf" , token = None )
model = Model ( model_path , n_gpu_layers = 0 , context_length = 2048 )
thread = Thread ( model , format = chatml )
# print(thread.send("hi")) #send a single msg to ai
# thread.interact() # interact with the model in terminal
# start webui
# webui = WebUI(thread)
# webui.start(host="0.0.0.0", port=8080, ssl=True) #Use ssl=True and make cert and key for https WebScout의 로컬 RAW-DOG 기능을 사용하면 터미널 프롬프트 내에서 Python 스크립트를 실행할 수 있습니다.
예:
import webscout . Local as ws
from webscout . Local . rawdog import RawDog
from webscout . Local . samplers import DefaultSampling
from webscout . Local . formats import chatml , AdvancedFormat
from webscout . Local . utils import download_model
import datetime
import sys
import os
repo_id = "YorkieOH10/granite-8b-code-instruct-Q8_0-GGUF"
filename = "granite-8b-code-instruct.Q8_0.gguf"
model_path = download_model ( repo_id , filename , token = '' )
# Load the model using the downloaded path
model = ws . Model ( model_path , n_gpu_layers = 10 )
rawdog = RawDog ()
# Create an AdvancedFormat and modify the system content
# Use a lambda to generate the prompt dynamically:
chat_format = AdvancedFormat ( chatml )
# **Pre-format the intro_prompt string:**
system_content = f"""
You are a command-line coding assistant called Rawdog that generates and auto-executes Python scripts.
A typical interaction goes like this:
1. The user gives you a natural language PROMPT.
2. You:
i. Determine what needs to be done
ii. Write a short Python SCRIPT to do it
iii. Communicate back to the user by printing to the console in that SCRIPT
3. The compiler extracts the script and then runs it using exec(). If there will be an exception raised,
it will be send back to you starting with "PREVIOUS SCRIPT EXCEPTION:".
4. In case of exception, regenerate error free script.
If you need to review script outputs before completing the task, you can print the word "CONTINUE" at the end of your SCRIPT.
This can be useful for summarizing documents or technical readouts, reading instructions before
deciding what to do, or other tasks that require multi-step reasoning.
A typical 'CONTINUE' interaction looks like this:
1. The user gives you a natural language PROMPT.
2. You:
i. Determine what needs to be done
ii. Determine that you need to see the output of some subprocess call to complete the task
iii. Write a short Python SCRIPT to print that and then print the word "CONTINUE"
3. The compiler
i. Checks and runs your SCRIPT
ii. Captures the output and appends it to the conversation as "LAST SCRIPT OUTPUT:"
iii. Finds the word "CONTINUE" and sends control back to you
4. You again:
i. Look at the original PROMPT + the "LAST SCRIPT OUTPUT:" to determine what needs to be done
ii. Write a short Python SCRIPT to do it
iii. Communicate back to the user by printing to the console in that SCRIPT
5. The compiler...
Please follow these conventions carefully:
- Decline any tasks that seem dangerous, irreversible, or that you don't understand.
- Always review the full conversation prior to answering and maintain continuity.
- If asked for information, just print the information clearly and concisely.
- If asked to do something, print a concise summary of what you've done as confirmation.
- If asked a question, respond in a friendly, conversational way. Use programmatically-generated and natural language responses as appropriate.
- If you need clarification, return a SCRIPT that prints your question. In the next interaction, continue based on the user's response.
- Assume the user would like something concise. For example rather than printing a massive table, filter or summarize it to what's likely of interest.
- Actively clean up any temporary processes or files you use.
- When looking through files, use git as available to skip files, and skip hidden files (.env, .git, etc) by default.
- You can plot anything with matplotlib.
- ALWAYS Return your SCRIPT inside of a single pair of ``` delimiters. Only the console output of the first such SCRIPT is visible to the user, so make sure that it's complete and don't bother returning anything else.
"""
chat_format . override ( 'system_content' , lambda : system_content )
thread = ws . Thread ( model , format = chat_format , sampler = DefaultSampling )
while True :
prompt = input ( ">: " )
if prompt . lower () == "q" :
break
response = thread . send ( prompt )
# Process the response using RawDog
script_output = rawdog . main ( response )
if script_output :
print ( script_output )WebScout은 오프라인 LLM과 함께 사용하기 위해 포옹 얼굴 모델을 GGUF 형식으로 변환하고 양자화하는 도구를 제공합니다.
예:
from webscout . Extra import gguf
"""
Valid quantization methods:
"q2_k", "q3_k_l", "q3_k_m", "q3_k_s",
"q4_0", "q4_1", "q4_k_m", "q4_k_s",
"q5_0", "q5_1", "q5_k_m", "q5_k_s",
"q6_k", "q8_0"
"""
gguf . convert (
model_id = "OEvortex/HelpingAI-Lite-1.5T" , # Replace with your model ID
username = "Abhaykoul" , # Replace with your Hugging Face username
token = "hf_token_write" , # Replace with your Hugging Face token
quantization_methods = "q4_k_m" # Optional, adjust quantization methods
) Webscout의 autollama 유틸리티는 포옹 얼굴에서 모델을 다운로드 한 다음 자동으로 Ollama- 준비를합니다.
from webscout . Extra import autollama
model_path = "Vortex4ai/Jarvis-0.5B"
gguf_file = "test2-q4_k_m.gguf"
autollama . main ( model_path , gguf_file ) 명령 줄 사용 :
GGUF 변환 :
python -m webscout.Extra.gguf -m " OEvortex/HelpingAI-Lite-1.5T " -u " your_username " -t " your_hf_token " -q " q4_k_m,q5_k_m " Autollama :
python -m webscout.Extra.autollama -m " OEvortex/HelpingAI-Lite-1.5T " -g " HelpingAI-Lite-1.5T.q4_k_m.gguf " 메모:
"your_username" 및 "your_hf_token" 실제 포옹 얼굴 자격 증명으로 바꾸십시오.autollama 의 model_path 는 Hugging Face Model ID이며 gguf_file GGUF 파일 ID입니다. Webai 터미널 GPT 및 열린 통역사 python -m webscout.webai webai --provider " phind " --rawdog기부금을 환영합니다! WebScout에 기여하려면 다음을 수행하십시오.