Giter Site home page Giter Site logo

ai-bricks's People

Contributors

mobarski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ai-bricks's Issues

Endless loop in Agents

I have tried to use both your react/v3 agent, and your v2 agent, without luck. The model just keeps repeating itself, even if it has the answer. I am using Claude

Code

import time
from ai_bricks.api import openai
from ai_bricks.api import anthropic
from ai_bricks import agent

aa = agent.actions
aa.wikipedia_search_many.__name__ = 'wikipedia-summary'
aa.wikipedia_get_data.__name__ = 'wikipedia-data'
actions = [
    aa.wikipedia_search_many,
    aa.wikipedia_get_data,
    aa.python_eval,
]

q = "What is two plus two"

model = anthropic.model('claude-instant-v1', temperature=0.0) # key from ANTHROPIC_API_KEY env variable

a = agent.get('react')(model=model, actions=actions)
answer = a.run(q, n_turns=3)

Output:

Task: Answer the following question as best you can.
Question: What is two plus two
You are augmented with the following actions: 
- wikipedia-summary: query wikipedia with a list of entities / subjects and return a summary for each one
- wikipedia-data: query wikipedia with a list of entities / subjects and return the main data table for each one
- python_eval: evaluate single python expression; imported modules: math, time, random, datetime; do not import anything else; use only one line of code
Use the following response protocol and format: 
Question: What is two plus two
Thought: you should always think about what to do
Action: the action to take (only the name, not the arguments)
Input: the input to the action
Observation: the result of the action
Summary: key takeways - extract all data (esp numeric data) relevant to the question, one item per line
Repeat: 
- this Question/Thought/Action/Input/Observation/Summary can repeat N times
- if you don't want to take any action you can skip from one Thought to the next Thought
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Important: 
- always follow the protocol - Thought, Action, Input, Observation, Summary, Thought, etc
- never use empty Input 
- you don't know current time and date
Thought: you should always think about what to do
Action: python_eval
Input: math.ceil(2+2)
---
CLEAR: 0
Observation: 4
Reminder: The next item must be a Summary followed by a Thought!
Thought: you should always think about what to do
Action: python_eval
Input: math.ceil(2+2)
---
CLEAR: 8
Observation: 4
Reminder: The next item must be a Summary followed by a Thought!
Thought: you should always think about what to do
Action: python_eval
Input: math.ceil(2+2)
---
CLEAR: 8
Observation: 4
Reminder: The next item must be a Summary followed by a Thought!

DONE IN 2.7s (3 steps, 0.90s per step) FOR $0.0027 (1264 claude-instant-v1 tokens)

Question: What is two plus two

Final Answer: 

Deprecated OpenAI API Version

Hi! I was reviewing your ask-pdf app, but it wasn't working.

The problem is apparently in the ai_bricks/api/openai client, the API version has been deprecated recently.

You can check more info about the changes here: openai/openai-python#742

Nice code, btw.

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.