Comments (4)
Hi @CyberTimon
Just heard. @nickmitchko just sent a push to handle the new api. You will need to adjust your configs to match, but it looks like it will work.
from agentforge.
@DataBassGit streaming won't work, but the standard API seems to work.
If you use AutoGPT, (this fork), the following code needs to be updated: ...
local_llm.py
import json
import requests
from autogpt.config.config import Config
class OoobaboogaAPI:
"""This class implements the singleton pattern in Python."""
_instance = None
def __new__(cls, *args, **kwargs):
if cls._instance is None or cls._instance.__class__!= cls:
cls._instance = super(OoobaboogaAPI, cls).__new__(cls)
return cls._instance
def __init__(self, CFG: Config):
self.host = CFG.oobabooga_api_host
def generate_text(self, input: str, **manual_params) -> None:
request = {
'prompt': input,
'max_new_tokens': 250,
'do_sample': True,
'temperature': 1.3,
'top_p': 0.1,
'typical_p': 1,
'repetition_penalty': 1.18,
'top_k': 40,
'min_length': 0,
'no_repeat_ngram_size': 0,
'num_beams': 1,
'penalty_alpha': 0,
'length_penalty': 1,
'early_stopping': False,
'seed': -1,
'add_bos_token': True,
'truncation_length': 2048,
'ban_eos_token': False,
'skip_special_tokens': True,
'stopping_strings': []
} | manual_params
# params = {
# 'max_new_tokens': 200,
# 'do_sample': True,
# 'temperature': 0.72,
# 'top_p': 0.73,
# 'typical_p': 1,
# 'repetition_penalty': 1.1,
# 'encoder_repetition_penalty': 1.0,
# 'top_k': 0,
# 'min_length': 0,
# 'no_repeat_ngram_size': 0,
# 'num_beams': 1,
# 'penalty_alpha': 0,
# 'length_penalty': 1,
# 'early_stopping': False,
# 'seed': -1,
# 'add_bos_token': True,
# 'truncation_length': 2048,
# 'ban_eos_token': False,
# 'skip_special_tokens': True,
# 'stopping_strings': [],
# } | manual_params
# payload = json.dumps([input, params])
# post_payload = {
# "data": [
# payload
# ]
# }
# print(f"POST PAYLOAD: {post_payload}")
response = requests.post(f"{self.host}/api/v1/generate", json=request).json()
print(f"RESPONSE: {response}")
# reply = response["data"][0]
reply = response['results'][0]['text']
print(f"REPLY: {reply}")
return reply
from agentforge.
We're not using AutoGPT. We were based on BabyAGI, but that code has basically been completely replaced at this point. I will review this code at some point, but we are not currently focused on getting streaming APIs working. If you do manage to get streaming working, however, feel free to send another PR. Thanks for your help!
from agentforge.
Nick's code was merged and should resolve this issue.
from agentforge.
Related Issues (18)
- API Key exposed HOT 1
- the required logger_config.py file is missing from Logs folder HOT 1
- Better Error Handling for Encoder models HOT 1
- Task subdivision algorithm HOT 3
- Need for better documentation HOT 1
- Replace task executor with a SmartGPT scheme HOT 2
- Incorporate LLM Cascades for API cost savings HOT 1
- Open source structure and contribution guide HOT 1
- Update Anthropic Client HOT 6
- No test folder HOT 1
- Is this the Auto-GPT alternative you're working on? HOT 1
- Bug: Init files not blank
- No embedding_function provided, using default embedding function: SentenceTransformerEmbeddingFunction HOT 3
- Making better documentation on how to link oobabooga api HOT 3
- Error initing empty project HOT 1
- Personal LLM support
- Error creating collection. HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agentforge.