Coder Social home page Coder Social logo

Comments (2)

Muhtasham avatar Muhtasham commented on August 14, 2024

maybe you can try this, described here

When a request to your llm app fails, reliableGPT handles it by:

Retrying with an alternate model - GPT-4, GPT3.5, GPT3.5 16k, text-davinci-003
Retrying with a larger context window model for Context Window Errors
Sending a Cached Response (using semantic similarity)
Retry with a fallback API key for Invalid API Key errors

from streamlit-agent.

sfc-gh-jcarroll avatar sfc-gh-jcarroll commented on August 14, 2024

Hi @askintution , minimally you can do try/catch on the agent.run call to handle the error (such as printing a friendly st.error() or having the assistant respond with a useful message)

try:
    response = agent.run(user_input, callbacks=[st_callback])
except: # or filter to certain errors you know about like openai.AuthenticationError
    st.error("Encountered an error, try again later")

LangChain also has some throttling and automatic retry support for the case where rate limit is due to frequent requests. It's outside the scope of reference implementations in this repository but you can find ideas in LangChain documentation and user issues 😄

from streamlit-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.