Comments (11)
What would be the expected response if a single request to OpenAI exceeds the content limit (a long article)?
from pokitoki.
It would be an error returned by the OpenAI API.
from pokitoki.
I agree. However it's possible to split a text into several requests
from pokitoki.
I am sorry. I thought about different thing. Something like this: max_tokens=1000
from pokitoki.
The max_tokens
parameter in openai.ChatCompletion
is the maximum number of tokens to generate (the number of output tokens). It's currently hardcoded to 1000.
The number of input tokens is determined by the user message. After replacing the URLs with their content, it could be significant.
OpenAI has a limit on the total number of tokens (prompt + input + output). It will return an error if there are too many tokens.
All of this is beyond the scope of this issue. Handling large numbers of tokens is important, but that's a question for another time.
from pokitoki.
Here goes: External links
from pokitoki.
def is_text(self) -> bool:
"""Checks if the content type is plain text."""
if not self.content_type:
return False
if self.content_type.startswith("text/"):
return True
if self.content_type in self.allowed_content_types:
return True
return False
Isn't it better to raise an exception instead of returning False
? My idea is simple: users will understand that their links are unprocessable before request to Openai.
from pokitoki.
I prefer the current implementation. The bot states that it can't process the binary content:
Q: Explain this paper in simple terms https://arxiv.org/pdf/1706.03762.pdf
A: I'm sorry, but I cannot access the contents of the paper you provided as it appears to be unknown binary content. Can you please provide me with the correct link or the title of the paper so I can provide you with a clear explanation?
from pokitoki.
This is my example:
Read the most popular comments: https://www.youtube.com/watch?v=outcGtbnMuQ
I apologize, but the content you provided does not include any comments from viewers. Can you please provide a different link or specify where the comments can be found?
There are not handlers in case when content_type not in self.allowed_content_types
but link contains text-ish content
from pokitoki.
This is another case. The content type is OK (text/html), but the actual content is loaded dynamically via JS. I don't think I will support such cases.
from pokitoki.
I'm pretty happy with with the implementation so far.
from pokitoki.
Related Issues (20)
- Message token count exceeds the maximum allowed token count HOT 3
- Image generation HOT 2
- Requests to openai are blocking HOT 1
- `config` telegram.token property problem HOT 6
- Can start directly through the. py file? HOT 1
- Can it support Azure openai? Or an endpoint that can be customized for api access? HOT 10
- Support for voice messages HOT 8
- Add new message to old context HOT 2
- Failed to answer. Reason: httpx.ConnectTimeout HOT 1
- The ability to process the content of YouTube videos based on subtitles.
- Is it possible for the bot to remember messages of the past history? HOT 4
- Allow streaming response HOT 1
- TypeError: 'type' object is not subscriptable HOT 5
- Possibility to use with different LLM other than chagpt? HOT 1
- DALL-E 3? HOT 1
- Markdown does not work in bot replies HOT 1
- update openai>=1.3.0 to support OPENAI_BASE_URL environment variable HOT 1
- "Message is too long" HOT 4
- The bot works in groups and chats not included in the list /config telegram.chat_ids HOT 1
- Bot does not respond to group users not included in the userlist HOT 5
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 pokitoki.