Skip to content

Commit

Permalink
Upd Readme. + Assets. Upd ci
Browse files Browse the repository at this point in the history
Added lib path in cmake lists
  • Loading branch information
fbrand-new committed Aug 29, 2023
1 parent f3452ad commit 12ce72d
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 62 deletions.
97 changes: 50 additions & 47 deletions .github/workflows/conda-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
matrix:
build_type: [Release]
os: [ubuntu-latest, macos-latest, windows-2019]
fail-fast: false
fail-fast: true

steps:
- uses: actions/checkout@v3
Expand All @@ -76,7 +76,7 @@ jobs:
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules eigen ace sqlite
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules eigen ace sqlite nlohmann_json
- name: Download YARP [Linux&macOS]
Expand All @@ -100,14 +100,16 @@ jobs:
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/share/yarp::${YARP_DATA_DIRS}" >> $GITHUB_ENV
# libaoi dependencies
# curl
cd ${GITHUB_WORKSPACE}
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
./vcpkg integrate install
./vcpkg install curl
./vcpkg install nlohmann-json
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
#liboai
cd ${GITHUB_WORKSPACE}
git clone https://github.com/D7EAD/liboai.git
Expand All @@ -116,7 +118,6 @@ jobs:
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=true ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
Expand All @@ -137,25 +138,26 @@ jobs:
-DYARP_COMPILE_ALL_FAKE_DEVICES:BOOL=ON
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/Library/share/yarp;${YARP_DATA_DIRS}" >> $GITHUB_ENV
# libaoi dependencies
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/Library/share/yarp;$YARP_DATA_DIRS}" >> $GITHUB_ENV
cd ${GITHUB_WORKSPACE}
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
./vcpkg integrate install
./vcpkg install curl
./vcpkg install nlohmann-json
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
#liboai
cd ${GITHUB_WORKSPACE}
pwd
git clone https://github.com/D7EAD/liboai.git
cd liboai/liboai
mkdir build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. \
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=true ..
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_POSITION_INDEPENDENT_CODE=true ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
Expand All @@ -166,26 +168,23 @@ jobs:
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} .. \
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DLIBOAI_INSTALL_PATH=${GITHUB_WORKSPACE}/liboai \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Configure [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C CALL {0}
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON ^
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}\Library .. ^
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake ^
-DLIBOAI_INSTALL_PATH=${GITHUB_WORKSPACE}/liboai ^
cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON \
-DCMAKE_PREFIX_PATH=${CONDA_PREFIX}/Library \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DLIBOAI_INSTALL_PATH=${GITHUB_WORKSPACE}/liboai \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library .. \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Build [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
Expand All @@ -209,21 +208,21 @@ jobs:
- name: Build [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C CALL {0}
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C CALL {0}
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C CALL {0}
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
Expand Down Expand Up @@ -252,7 +251,7 @@ jobs:
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
sudo apt-get install -qq -y libc6-dbg
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules eigen valgrind ace
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules eigen valgrind ace sqlite nlohmann_json
- name: Download YARP [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
Expand All @@ -276,22 +275,27 @@ jobs:
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/share/yarp::${YARP_DATA_DIRS}" >> $GITHUB_ENV
# libaoi dependencies
# curl
cd ${GITHUB_WORKSPACE}
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
./vcpkg integrate install
./vcpkg install curl
./vcpkg install nlohmann-json
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
#liboai
cd ${GITHUB_WORKSPACE}
git clone https://github.com/D7EAD/liboai.git
cd liboai/liboai
cmake --build . --config ${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=true \
cmake --install . --config ${{ matrix.build_type }}
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_POSITION_INDEPENDENT_CODE=true ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
- name: Configure [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
Expand All @@ -301,10 +305,9 @@ jobs:
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DLIBOAI_INSTALL_PATH=${GITHUB_WORKSPACE}/liboai \
-DYARP_VALGRIND_TESTS:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} .. \
-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/scripts/buildsystems/vcpkg.cmake \
-DLIBOAI_INSTALL_PATH=${GITHUB_WORKSPACE}/liboai \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Build [Linux&macOS]
Expand Down
46 changes: 37 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
![YARP logo](doc/images/yarp-robot-24.png?raw=true "yarp-devices-llm")
![YARP logo](https://github.com/robotology/yarp/raw/master/doc/images/yarp-robot-24.png?raw=true)
Yarp devices for Large Language Models
=====================

This repository contains the YARP plugin for Large Language Models.

:construction: This repository is currently work in progress.

:construction: The software contained is this repository is currently under testing.

:construction: APIs may change without any warning.

:construction: This code should be not used before its first official release

Documentation
-------------

Documentation of the individual devices is provided in the official Yarp documentation page:

[![YARP documentation](https://img.shields.io/badge/Documentation-yarp.it-19c2d8.svg)](https://yarp.it/latest/group__dev__impl.html)

Prerequisites
Expand Down Expand Up @@ -78,6 +71,38 @@ source .env
set +a
```

Usage
---------

Assuming that the user has already installed [YARP](https://www.github.com/robotology/yarp) and the related LLM devices, one can use this basic configuration example

~~~
yarpserver
~~~

~~~
set -a
source .env
set +a
yarprobotinterface --from assets/LLMDeviceExample.xml
~~~

~~~
yarp rpc /yarpgpt/rpc
>>help
Responses:
*** Available commands:
setPrompt
readPrompt
ask
getConversation
deleteConversation
help
>>setPrompt "You are a geography expert who is very concise in its answers"
Response: [ok]
>>ask "What is the capital of Italy?"
Response: [ok] Rome. #This answer may vary in the form, hopefully not in the content.
~~~
CI Status
---------

Expand All @@ -86,6 +111,9 @@ CI Status
License
---------

[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

This software is distributed under the terms of the BSD-3-Clause.


Maintainers
Expand Down
25 changes: 25 additions & 0 deletions assets/LLMDevice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
SPDX-License-Identifier: BSD-3-Clause
-->
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">
<robot name="LLMServer" build="2" portprefix="" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<device name="LLMDevice" type="GPTDevice">
</device>
<device name="LLM_nws" type="LLM_nws_yarp">
<param extern-name="LLMNwsYarp_name" name="name">
/yarpgpt/rpc
</param>
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdeviceLLM">
LLMDevice
</elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
20 changes: 14 additions & 6 deletions src/devices/GPTDevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ if(NOT SKIP_GPTDevice)
GPTDevice.h
)

cmake_path(SET LIBOAI_INCLUDE_PATH "${LIBOAI_INSTALL_PATH}/liboai/include")
cmake_path(SET LIBOAI_LIBRARY_PATH "${LIBOAI_INSTALL_PATH}/liboai/build/Release")

target_link_directories(yarp_GPTDevice
PUBLIC
"${LIBOAI_LIBRARY_PATH}"
)

target_include_directories(yarp_GPTDevice
PUBLIC
"${LIBOAI_INCLUDE_PATH}"
"${CMAKE_CURRENT_SOURCE_DIR}"
)

target_link_libraries(yarp_GPTDevice
PRIVATE
YARP::YARP_os
Expand All @@ -28,12 +42,6 @@ if(NOT SKIP_GPTDevice)
CURL::libcurl
)

target_include_directories(yarp_GPTDevice
PUBLIC
"${LIBOAI_INSTALL_PATH}/liboai/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
)

yarp_install(
TARGETS yarp_GPTDevice
EXPORT yarp-device-GPTDevice
Expand Down

0 comments on commit 12ce72d

Please sign in to comment.