Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion factool/utils/claim_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import asyncio
from tqdm import tqdm
from factool.env_config import factool_env_config
from litellm import completion


# env
Expand All @@ -26,7 +27,7 @@
# Make api calls asynchronously
async def run_api(messages):
async def single_run(message):
output = openai.ChatCompletion.create(
output = completion(
model=config['model_name'],
messages=message,
max_tokens=config['max_tokens'],
Expand Down
4 changes: 3 additions & 1 deletion factool/utils/openai_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import Any, List
import os
import pathlib
from litellm import acompletion


from factool.env_config import factool_env_config
Expand All @@ -27,6 +28,7 @@ def __init__(
top_p=1,
request_timeout=60,
):
# TODO: modify this to allow Anthropic, Claude, etc
if 'gpt' not in model_name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If more types of LLMs are supported, we probably need to generalize this line of code

openai.api_base = "http://localhost:8000/v1"
self.config = {
Expand Down Expand Up @@ -64,7 +66,7 @@ async def dispatch_openai_requests(
async def _request_with_retry(messages, retry=3):
for _ in range(retry):
try:
response = await openai.ChatCompletion.acreate(
response = await acompletion(
model=self.config['model_name'],
messages=messages,
max_tokens=self.config['max_tokens'],
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ packages = find:
include_package_data = True
install_requires =
openai==0.27.8
litellm==0.1.232
PyYAML==6.0
asyncio==3.4.3
numpy
Expand Down